Chapter 15 C++
Inheritance allows a new class to be based on an existing class
The new class inherits all the member variables and functions (except the constructors and destructor) of the class it is based on.
base class access specification
affects how the members of the base class are inherited by by derived class; when you create an object of a derived class, you can think of it as building built on top of an object of the bas class
in inheritance what is the general class
base class
in inheritance you can think of this as the parent class
base class
member access specification determines how members that are defined within the class are accessed
base class access specification determines how inherited members are accessed
in inheritance what is the specialized class
derived class
in inheritance you think as the child class
derived class
the base class inherits the members of the derive class
false
the base class
general class
when an "is a " relationship exists between classes it means that the specialized class has all the characteristics of genera class plus additional characteristics that make t special
in object oriented programming inheritance is used to create an "is a" relationship between classes
protected
private members of the base class are inaccessible to the derived class; protected members of the bas class become protected members of the derived class; public members of the base class become protected members of the derived class
private
private members of the base class are inaccessible to the derived class; protected members of the base class become private members of the derived class; public members of the base class become private members of the derived class
public
private members of the parse class are inaccessible to the derived class; protected members of the base class become protected members of the derived class; public members of the base class become public members of the derived class
derived class
specialized class; based on or derived from the base class; inherits the member variables and member functions of the base class without any of them being rewritten
protected members of a base class are like private members byt they may be accessed by derived classes
the base class access specification determines how private public and protected base class members are accessed when they are inherited by the derived classes
when one object is a specialized version of another object
there is an "is a" relationship between them a poodle is a dog a car is a vehicle a tree is a plant a rectangle is a shape
the first line of class declaration: class truck: public vehicle what is the name of the derived class is
truck
the first line of class declaration: class truck: public vehicle what is the name of the base class is
vehicle