Answer the following statements true (T) or false (F)
1. The virtual property is not inherited.
2. A class that has a pure virtual member function is called a concrete base class.
3. No objects can be defined of abstract base class type since it is an incomplete definition.
4. It is OK to assign between objects of base type and objects of derived type.
5. A pointer to objects of a derived class can be assigned pointers to objects of the base class in the inheritance hierarchy.
1. False
Suppose you derive from a base class with a virtual function. Then suppose you put a function in the derived class with the same signature as the virtual function in the base class. The derived class function will be automatically virtual, as will any member function with the same signature in any further derived classes.
2. False
The term is abstract base class. Presence of a pure virtual function member makes a class abstract. A derived class must define the pure virtual member function or that member function must be pure virtual in the derived class and the derived class must itself be abstract. .No objects can be defined of an abstract class.
3. True
Presence of a pure virtual function member makes a class abstract. A derived class must define the pure virtual member function or that member function must be pure virtual in the derived class and the derived class must itself be abstract. .No objects can be defined of an abstract class.
4. False
Assignment to a derived class object from a base class object is summarily rejected by the compiler. Assignment to a base class object from a derived class object is permitted, but has the slicing problem, wherein you lose the non-base class members in the derived object. Some examples abstracted from code that compiled. Here class D is derived from class B.
```
B b;
D d;
b = d; // ok to assign derived object to base class
//object.
//d = b; // error: no operator defined which takes
// a right-hand operand of type 'class B' (or
// there is no acceptable conversion)
```
5. False
If D is derived from B, then the following attempt to assign pointers as the question suggests nets this response from one of this writer’s compilers:
```
B* bPtr = new B;
D* dPtr = new B; //illegal: Unable to convert B* to D*
//Types are unrelated. Conversion
//requires a cast.
```
You might also like to view...
Consider the following email to a fellow technician: "Hey Joe! I really need some help here. I have a hard drive that will not keep a second partition. I KNOW THAT YOU SON OF A GUN REALLY KNOW THIS STUFF and i want your xpert mind. :-) Would you help me out? a3, awhfy? : -)" This is an example of
A) Good written communication skills B) Being proactive C) Teamwork D) Unprofessionalism
The __________ control enables you to place a menu bar in your window.
a) MenuTool b) MenuBar c) MenuStrip d) None of the above