Child cObj = new Parent()
Wahts the output ?

Answer Posted / giri

You can write below ways [Upcasting].

Child *cObj = new Parent();

Is This Answer Correct ?    5 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is advantage of inheritance?

690


Which is better struts or spring?

622


Write a program to sort the number with different sorts in one program ??

1920


Can static class have constructor?

585


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

1698






What is abstraction in oop?

635


What is class in oop with example?

621


What is the difference between abstraction and polymorphism?

617


Who invented oop?

659


What are two types of polymorphism?

611


What is an advantage of polymorphism?

597


Why interface is used?

553


What are the data types in oop?

608


Why do we use polymorphism?

579


Write a java applet that computes and displays the squares of values between 25 and 1 inclusive and displays them in a TextArea box

2036