8.1

Identify the error in the following program.

Answer

Constructor and Private (data & function) can not be inherited.

8.2

Identify the error in the following program.

Answer

The inheritance can be represented as follows:

Exarcise-1

Here B is virtual, but not E.

8.3

Identify the error in the following program.

Answer

The inheritance can be represented as follows:

Exarcise-2

Class AC: A, Here there is no identification of ABAC. If we write class ABAC; after #include it will not show any error massage.

8.4

Find errors in the following program. State reasons.

Answer

Here x1 is private, so x1 cannot be inherited.
y1 = x1; is not valid
z1 = x1; is not valid
m = y, x1; is not valid
m = z, x1; is not valid

8.5

Debug the following program.

Answer

d.display ( ); show ‘ambiguity error’.

Here display() function should be declared as virtual in B1 class.


Next Previous