Chapter 14


  1. OOP enables programmers to model programming objects after complex real-world objects, and to reuse existing, tested code.

  2. An example in this chapter of information hiding or encapsulation is the use of public member functions to govern read and write access to private member variables .

  3. Inheritance involves an is a relationship. An example is a student is a person.

  4. Containership involves a has a relationship. Examples include that a car has an engine and a person has a birthday.

  5. A structure is a programmer-defined data type that enables you to package related variables that may be of different data types.

  6. When you declare a structure, you are declaring a data type. You need to declare a variable of that structure to create an instance of it.

  7. You may initialize a structure using either an initialization list or a constructor.

  8. You can nest one structure within another structure, such as a birthday member variable of a Person structure being a Date structure itself.

  9. A structure may be passed by reference even if the function will not change the value of its member variables because less memory is required to pass the address of an object than the object itself, which may take up a lot of bytes. In this situation, you may precede the structure instance in the function argument list with the const keyword to prevent the function from inadvertently changing the values inside the structure instance.

  10. Member variables are, by default, public in a structure but private in a class.




C++ Demystified(c) A Self-Teaching Guide
C++ Demystified(c) A Self-Teaching Guide
ISBN: 72253703
EAN: N/A
Year: 2006
Pages: 148

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net