9.1

Identify the error in the following program.

Answer

Here P=n will replace with P=&n in the main() function. Because P is a pointer.

9.2

Identify the error in the following program.

Answer

The function

 

should write like as…

9.3

Identify the error in the following program.

Answer

Here we cannot write Human *H = new student(); in the main() function because base class’s member includes in derived class’s object so we should write this as follow
student *H = new Student();

9.4

Correct the errors in the following program.

Answer

Here T->getdata replace with T.getdata and T->display replace with T.display in the main() function. Because in this program T is object to pointer.

9.5

Debug and run the following program. What will be the output?

Answer

The virtual keyword must write in base class and prototype base class and derived base class of print function should same.


Next Previous