Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Fill in the Blank: Write the terms from this Word Bank to complete the sentences for #1-13 in the gold boxes.
When both a base class and a derived class have constructors, the base classs constructor is called
first (first/last).
When both a base class and a derived class have destructors, the base classs constructor is called last
(first/last).
An overridden base class function may be called by a function in a derived class by using the scope
resolution
operator.
When a derived class redefines a function in a base class, which version of the function do objects that are
defined of the base class call? base class version
A(n) virtual member function in a base class expects to be overridden in a derived class.
static binding is when the compiler binds member function calls at compile time.
polymorphism is when member functions in a class hierarchy behave differently, depending upon which
object performs the call.
When a pointer to a base class is made to point to a derived class, the pointer ignores any Overriding ,
virtual
the derived class performs, unless the function is
A(n) Pure Virtual function has no body, or definition, in the class in which it is declared.
A(n) chain of inheritance is where one class is derived from a second class,
which in turn is derived from a third class.
multiple inheritance is where a derived class has two or more base classes.
In a private base class, this base class MEMBER access ...becomes this access specification in the derived class
specification
private inaccessible
protected private
public private
In a protected base class, this base class MEMBER access ...becomes this access specification in the derived class
specification
private inaccessible
protected protected
public protected
In a public base class, this base class MEMBER access ...becomes this access specification in the derived class
specification
private inaccessible
protected protected
public public
True or False: Determine whether each statement is true or false in the green box. If false, rewrite the
statement to make it true in the gold box
The base class s access specification affects the way base class member functions
false
may access base class member variables.
The base class s access specification affects the way the derived class member functions
may access the base class member variable
The base class s access specification affects the way the derived class inherits
true
members of the base class.
true Private members of a private base class become inaccessible to the derived class.
false The base class constructor is called after the derived class constructor.
The base class constructor is called before the derived class constructor
true The base class destructor is called after the derived class destructor.
false It isnt possible for a base class to have more than one constructor.
It is possible for a base class to have more than one constructor.
Arguments are passed to the base class constructor by the derived class
true
constructor.
A member function of a derived class may not have the same name as a
false
member function of the base class.
A member function of a derived class may have the same name as a
member function of the base class.
true Pointers to a base class may be assigned the address of a derived class object.
Examine the following classes. The table lists the variables that are members of the Third class (some are
inherited). Complete the table by filling in the access specification each member will have in the Third class.
Write ''inaccessible'' if a member is inaccessible to the Third class.
Member
Access Specification in Third class
Variable
a inaccessible
b protected
c protected
d inaccessible
e protected
f public
g Private
h Protected
i public