Child cObj = new Parent()
Wahts the output ?

Answer Posted / chetan

it will execute without an error. if Parent class is
parent/base class and child is the child/drive class which
inherit parent class.
In the other worlds you are invoking drive class method with
the reference of base class.

Is This Answer Correct ?    3 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between inheritance and polymorphism?

561


Can bst contain duplicates?

664


What is oops and its features?

580


Why do we use oops?

588


What is the point of polymorphism?

580






What is polymorphism what are the different types of polymorphism?

557


How many human genes are polymorphic?

566


What are properties in oop?

603


What is oops concept with example?

574


What does <> mean pseudocode?

618


Can destructor be overloaded?

593


What is and I oop mean?

615


if i have same function with same number of argument but defined in different files. Now i am adding these two files in a third file and calling this function . which will get called and wht decide the precedence?

2749


class CTest { public: void someMethod() { int nCount = 0; cout << "This is some method --> " << nCount; } }; int main() { CTest *pctest; pctest->someMethod(); return 0; } It will executes the someMethod() and displays the value too. how is it possible with our creating memory for the class . i think iam not creating object for the class. Thanks in Advance... Prakash

1690


What is the point of oop?

646