Child cObj = new Parent()
Wahts the output ?

Answer Posted / donga bangarraju

sorry for the earlier post, this output is giving error like
initializing cannot convert to Paretn* to Child*, if u want
correct this code write like this, this is downcasting or
using RTTI mechanism in C++;

Parent* p =new Child;
Child* obj= dynamic_cast<Child*>(p);

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can main method override?

580


How do you use inheritance in unity?

585


What is the purpose of polymorphism?

671


What is difference between oop and pop?

609


which feature are not hold visual basic of oop?

1721






What is interface in oop?

656


Can private class be inherited?

615


What is polymorphism what is it for and how is it used?

570


What is abstract class in oop?

526


Is html an oop?

573


IS IT NECESSARY TO INITIALIZE VARIABLE? WHAT IF THE INSTANCE VARIABLE IS DECLARED final ? IS IT NECESSARY TO INITIALIZE THE final VARIABLE AT THE TIME OF THEIR DECLARATION?

1574


What is advantage of inheritance?

685


What do you mean by Encapsulation?

637


Write a program to reverse a string using recursive function?

1788


why reinterpret cast is considered dangerous?

1896