Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Answer the following questions about classes and inheritance. a) Fill in the sec

ID: 3581849 • Letter: A

Question

Answer the following questions about classes and inheritance.

a) Fill in the second column of the following table with “private”, “protected”, “public”, or “inaccessible”.

In a base class that is inherited with the public

base access specification, a member that had

THIS access specification in the base class …

… has THIS effective

access level in the derived class

private

protected

public

b) When both a base class and a derived class have constructors, the body of the base class constructor is executed __________ (first/last).

c) When both a base class and a derived class have destructors, the body of the base class destructor is executed __________ (first/last).

d) Describe one of the situations/code in which we made use of the friend declaration.

In a base class that is inherited with the public

base access specification, a member that had

THIS access specification in the base class …

… has THIS effective

access level in the derived class

private

protected

public

Explanation / Answer

b) body of base class constructor is executed first

c)body of base class destructor is executed last

d) when a function of a class needs to access the private and protected members of another class .then this function needs to be made as friend function to that class.

a) private - inaccessible

protected - protected,private

public - public