出版时间:2009-9 出版社:清华大学出版社 作者:巴拉古路萨米 页数:631
Tag标签:无
前言
Object-Oriented Programming (OOP) has become the preferred programming approach bythe software industries, as it offers a powerful way to cope with the complexity of real-worldproblems. Among the OOP languages available today, C++ is by far the most widely usedlanguage.Since its creation by Bjarne Stroustrup in early 1980s, C++ has undergone many changesand improvements. The language was standardized in 1998 by the American NationalStandards Institute (ANSI) and the International Standards Organization (ISO) byincorporating not only the new features but also the changes suggested by the user groups.This book has been thoroughly revised and this edition confirms to the specifications ofANSI/ISO standards. Besides confirming to the standards, many smaller changes andadditions to strengthen the existing topics as well as corrections to typographical errors andcertain inaccuracies in the text have been incorporated. The highlight of this edition is theinclusion of two new programming projects in Appendix A - (1) Menu Based CalculationSystem and (2) Banking System that demonstrate how to integrate the various features ofC++ in real life applications.This book is for the programmers who wish to know all about C++ language and object-oriented programming. It explains in a simple and easy-to-understand style the what, whyand how of object-oriented programming with C++. The book assumes that the reader isalready familiar with C language, although he or she need not be an expert programmer. The book provides numerous examples, illustrations and complete programs. The sampleprograms are meant to be both simple and educational. Wherever necessary, pictorialdescriptions of concepts are included to improve clarity and facilitate better understanding.The book also presents the concept of object-oriented approach and discusses briefly theimportant elements of object-oriented analysis and design of systems.
内容概要
本书以一种简单易懂的写作风格,介绍了何谓C++面向对象程序设计、为什么以及如何用C++进行面向对象程序设计。书给出了大量的示例、演示说明以及完整的程序。这些示例程序既简单也很具有教学意义。在必要的时候,本书还使用了概念图,使得介绍更加清晰,便于更好地理解。本书还介绍了面向对象方法的概念,简要讨论了系统的面向对象分析与设计的重要内容。本书的最大亮点是附录A的两个新的程序设计项目:(1)基于菜单的计算系统;(2)银行系统。它们演示了如何在现实应用程序中集成C++的各种特性。 本书不仅可以作为高等院校C++面向对象程序设计的教材,也是希望了解C++语言和面向对象程序设计知识的专业人员的很好参考书。
作者简介
作者:(印度)巴拉古路萨米(E Balagurusamy)
书籍目录
Preface xiii1 Principles of Object-Oriented Programming 1.1 Software Crisis 1.2 Software Evolution 1.3 A Look at Procedure-Oriented Programming 1.4 Object-Oriented Programming Paradigm 1.5 Basic Concepts of object-Oriented Programming 1.6 Benefits of OOP 1.7 Object-Oriented Languages 1.8 Applications of OOP Summary Review Questions 2 Beginning with C++ 2.1 Whatis C++? 2.2 Applications of C++ 2.3 A Simple C++ Program 2.4 More C++ Statements 2.5 An Example with Class 2.6 Structure of C++ Program 2.7 Creating the Source File 2.8 Compiling and Linking Summary Review Questions Debugging Exercises Programming Exercises 3 Tokens,Expressions and Control Structures 3.1 Introduction 3.2 Tokens 3.3 KeyWords 3.4 Identifiers and Constants 3.5 Basic Data Types 3.6 User-Defined Data Types 3.7 DeriVed Data Types 3.8 SymbolicConstants 3.9 Type Compatibility 3.10 Declaration of Variables 3.11 Dynamic initialization of Variables 3.12 Reference Variables 3.13 Operators in C++ 3.14 Scope Resolution Operator 3.15 Member Dereferencing Operators 3.16 Memory Management Operators 3.17 Manipulators 3.18 Type Cast Operator 3.19 EXPressions and their Types 3.20 SpecialAssignment Expressions 3.21 Implicit Conversions 3.22 Operator Overloading 3.23 Operator Precedence 3.24 Control Structures Summary Review Questions Debugging Exercises Programming Exercises 4 Functions in C++ 4.1 Introduction 4.2 The Main Function 4.3 Function Prototyping 4.4 Call by Reference 4.5 Return by Reference 4.6 Inline Functions 4.7 DefaultArgUments 4.8 constArgUments 4.9 Function Overloading 4.10 Friend and Virtual Functions 4.11 Math Library Functions Summary Review Questions Debugging Exercises 5 Classes and Objects Programming Exercises 5.1 Introduction 5.2 C Structures Revisited 5.3 Specifying a Class ……6 Constructors and Destructors 7 Operator Overloading and Type Conversions8 Inheritance:Extending Classes9 Pointers,Virtual Functions and Polymorphism10 Managing Console I/O Operations 11 Working with Files12 Templates13 Exception Handling 14 Introduction to the Standard Template Library15 Manipulating Strings16 New Featrues of ANSI C++ Standard 17 Object-Oriented Ststems DevelopmentAppendix A: Proj'ects Appendix B: EMcuting Turbo C+ + Appendix C: executing C+ + Under Windows Appendix D: Glossary of ANSI C+ + Keywords Appendix E: C+ + OPeratorprCcedence Appendix F: POints to Remember Appendix G: Glossary of important C+ + and OOP Terms Appendix H: C+ + Proficiency Test Bibliography
章节摘录
插图:not only creates the object intl of type integer but also initializes its data members m andn to zero. There is no need to write any statement to invoke the constructor function (as wedo with the normal member functions). If a 'normal' member function is defined for zeroinitialization, we would need to invoke this function for each of the objects separately. Thiswould be very inconvenient, if there are a large number of objects. A constructor that accepts no parameters is called the default constructor. The defaultconstructor for class A is At.A0. If no such constructor is defined, then the compiler suppliesa default constructor. Therefore a statement such asA a;invokes the default constructor of the compiler to create the object a. The constructor functions have some special characteristics. These are :They should be declared in the public section.They are invoked automatically when the objects are created.They do not have return types, not even void and therefore, and they cannot return values.They cannot be inherited, though a derived class can call the base class constructor.Like other C++ functions, they can have default arguments.Constructors cannot be virtual. (Meaning of virtual will be discussed later in Chapter 9.)We cannot refer to their addresses.An object with a constructor (or destructor) cannot be used as a member of a union.They make 'implicit calls' to the operators new and delete when memory alloca-tion is required.
编辑推荐
《C++面向对象程序设计(第4版)》:大学计算机教育国外著名教材系列(影印版)
图书封面
图书标签Tags
无
评论、评分、阅读与下载