Definitions

A class is a user-defined type.[2]

[2] Please note that the terms class and storage class have nothing to do with one another. This is another case where C++ reuses the same word for different concepts, although at least “storage class” isn't a keyword. We should be grateful for such small favors.

A class interface tells the compiler what facilities the class provides. This interface is usually found in a header file, which by convention has the extension .h.[3]

[3] At least, that is the convention for classes created by “normal” programmers, like you and me. The header files that define the classes in the C++ standard library have no extensions and in fact may not even be stored in normal files. An example is the <string> header file that we have been using.

A class implementation tells the compiler how to implement the facilities defined in the class interface. This is usually found in a source code file, which in the case of the compiler on the CD in the back of this book usually has the extension .cpp.

An object is a variable of a class type. Its behavior is defined by the header file and implementation of the class.[4]

[4] Some people use “object” to refer to a variable of any type, whether native or user-defined.

A member function is a function that is part of the definition of a class.

A member variable is a variable that is part of the definition of a class.

Object-oriented programming is the organization of programs as collections of objects exhibiting user-defined behavior, rather than as collections of functions operating on variables of native data types.[5]

[5] Purists may not approve of this use of the term object-oriented programming, as I'm not using this term in its strictest technical sense. However, since we are using objects and classes as our central organizing ideas, using the term object-oriented programming seems reasonable to me in this context. Chapters 9 and 10 will cover the other main concepts included in the strict definition of object-oriented programming.

Encapsulation is the concept of hiding the details of a class inside the implementation of that class, rather than exposing them in the interface. This is one of the primary organizing principles that characterize object-oriented programming.

Internals, in the case of native data types, refers to details of the implementation of these types in the compiler. In the case of class types, internals means the details of implementation of the type rather than what it does for the user.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset