OOP1 Inheritance Flashcards

1
Q

What is a class that inherits from another called?

A

Derived class, sub class, child class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a class that is inherited from called?

A

Base class, super class, parent class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What can a derived class access from its base class (using public inheritance)?

A

Only that which is not private

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

When a derived class is instatiated, what constructors are called and in what order?

A

The base class constructor is called first, the derived class after

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How to interit from another class?

A

class derivedFoo : public baseFoo
{…};

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How to pass arguments to the constructor of the base class?

A

classFoo::classFoo(argumentFoo) : baseFoo(argumentFoo)
{…}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is static binding?

A

The compile time determination of which member function will be used based on class type of object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What arguments will a member function take if its parameter is of a certain type?

A

It will accept arguments of the same type, or any types that descended from it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is dynamic binding?

A

The run time determination of which function to call for a particular object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the keyword for creating a member function that uses dynamic binding?

A

Virtual

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

If foo is a virtual function, the function of the class type of the ___ will be invoked

A

Argument object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

If foo is not a virtual function, the function of the class to which the ____ belongs will be invoked

A

The parameter object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

A polymorphic operation is?

A

An operation which has multiple meanings depending on the object bound to it at run time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Polymorphic operations must use which kind of argument passing?

A

Pass by reference

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What happens if polymorphic operations are passed to by value?

A

Members will not be copied that don’t exist in the parent class (member slicing), and static binding will occur

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

The keyword virtual appears in which class of the relationship?

A

The base class

17
Q

Can a function of a derived class alter the return type of a virtual function of its base?

A

No

18
Q

Is a base class has virtual functions, so must also its ____ function

A

Destructir

19
Q

What does the protected keyword do?

A

Act private externally, act public for any derived classes

20
Q

What does the friend keyword do?

A

Allows a non-member function full access to protected and private member variables and functions

21
Q

What does the explicit keyword do?

A

Controls unwanted implicit type casting of parameters for constructors

22
Q

An derived class method is said to be what, if it inherits from the parent without changing?

A

Overridden

23
Q

If base class has only parameterised constructor, you must create at least ___ constructors in the derived class

A

One

24
Q

What can be passed from a serviced constructor to the base constructor?

A

Constants and parameters