Definitions

Inheritance is the definition of one class as a more specific version of another class that has been previously defined. The newly defined class is called the derived (or sometimes child) class, and the previously defined class is called the base (or sometimes parent) class. In this book, we will use the terms base and derived. The derived class inherits all of the member variables and regular member functions from the base class. Inheritance is one of the primary organizing principles of object-oriented programming.

A regular member function is a member function that is not in any of the following categories:

  1. constructor,

  2. destructor,

  3. assignment operator (i.e., operator =).

A member function in a derived class is said to override a base class member function if the derived class function has the same signature (name and argument types) as that of the base class member function. The derived class member function will be called instead of the base class member function when the member function is referred to via an object of the derived class. A member function in a derived class with the same name but a different signature from that of a member function in the base class does not override the base class member function. Instead, it “hides” that base class member function, which is no longer accessible as a member function in the derived class.

For example, the function Reorder(ostream &) may be defined in a base class (StockItem) and in a derived class (DatedStockItem). When Reorder is called via an object of the base class StockItem, the base class version of Reorder will be called; when Reorder is called via an object of the derived class DatedStockItem, the derived class version of Reorder will be called. This behavior of C++ allows a derived class to supply the same functionality as a base class but implement that functionality in a different way.

A manipulator is a special type of member function of one of the iostream classes. Such a function controls how output will be formatted without itself necessarily producing any output.

A static member function is a member function of a class that can be called without reference to an object of that class. Such a function has no this pointer passed to it on entry, and therefore it cannot refer to member variables of the class.

Buffering is the use of a buffer to store or retrieve information.

A normal constructor is a constructor whose arguments supply enough information to initialize all of the member fields in the object being created.

The base class part of a derived class object is an unnamed component of the derived class object. Member variables and functions of a base class part declared in the public or protected part of the base class interface are accessible in the derived class member functions as though they were defined in the derived class.

The keyword protected is an access specifier. When present in a base class definition, it allows derived class functions access to members in the base class part of a derived class object while preventing access by other functions outside the base class.

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

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