OOP1 Inheritance Flashcards
What is a class that inherits from another called?
Derived class, sub class, child class
What is a class that is inherited from called?
Base class, super class, parent class
What can a derived class access from its base class (using public inheritance)?
Only that which is not private
When a derived class is instatiated, what constructors are called and in what order?
The base class constructor is called first, the derived class after
How to interit from another class?
class derivedFoo : public baseFoo
{…};
How to pass arguments to the constructor of the base class?
classFoo::classFoo(argumentFoo) : baseFoo(argumentFoo)
{…}
What is static binding?
The compile time determination of which member function will be used based on class type of object
What arguments will a member function take if its parameter is of a certain type?
It will accept arguments of the same type, or any types that descended from it
What is dynamic binding?
The run time determination of which function to call for a particular object
What is the keyword for creating a member function that uses dynamic binding?
Virtual
If foo is a virtual function, the function of the class type of the ___ will be invoked
Argument object
If foo is not a virtual function, the function of the class to which the ____ belongs will be invoked
The parameter object
A polymorphic operation is?
An operation which has multiple meanings depending on the object bound to it at run time
Polymorphic operations must use which kind of argument passing?
Pass by reference
What happens if polymorphic operations are passed to by value?
Members will not be copied that don’t exist in the parent class (member slicing), and static binding will occur