Answer the following statements true (T) or false (F)
1. A programmer can use inheritance with an existing library for which only the header file and binary are available, to derive a class more suitable to her purpose.
2. You never put a declaration of an inherited member in the derived class.
3. The one exception to this rule is the need to redefine a base class member function in the derived class.
4. An object of a derived class type has exactly one type, the type with which it was declared.
5. If a base class constructor is not called explicitly in the definition of a derived class constructor, an error results.
1. True
This feature of inheritance allows code reuse. The programmer needs only the class definition, not the implementation of the member functions of the class.
2. False
The one exception to this rule is the need to redefine a base class member function in the derived class.
3. False.
Inheritance has to do with class relationships where one class (the derived class) acquires (inherits) features from another class (the base class) and adds its own features to the inherited features.
4. False.
Object of class type whose class is derived has the “is-a” relationship to classes up the inheritance chain. A derived class has all the variables and member functions of the base class, hence is an object of base class type. It also has the member variables and functions added by its class so it is also an object of the derive class type. As the text says, an HourlyEmployee is also an Employee. Objects of class type whose class type is derived through several derivations have several types.
5 False
None of constructors, destructors, operator assignment, and friend functions are inherited. Nevertheless, they are invoked by the constructors and destructor of the derived class.
You might also like to view...
You can edit the guides to change their color to make them easier to see against the background, ____ objects to them, and lock them into place.
A. snip B. snap C. stomp D. stamp
Why is the backoff timing random when an Ethernet collision occurs?
What will be an ideal response?
What type of authentication is based on what the user has?
A. software token B. hardware token C. security token D. identity token
To delete an incorrect character in a document, simply click next to the incorrect character and then press the ____ key(s) to erase to the left of the insertion point.
A. CTRL+HOME B. DELETE C. BACKSPACE D. END