for example A,B,C,D are class all the 4 class contain one
method who() but the method who() implementaion is differnet
among each class. the relation among the 4 class are
A is base class and is inherited by B and C.and from this
two B and C where D is inherited.
the question is i want to display the output who() method in
all the classes(A,B,C,D)the output of who() method is
diferrent amond all the class(A,B,C,D)
------A------ virtuval who(print a)
override | |
who(print b) B C override who(print c)
| |
-------D------ override who(print d)

Answer Posted / ana

only pure virtual function cant be executed, so A.who() can
be executed
and since you override who() in B, C and D, the output is
different

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

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?

1575


Give an example where we have to specifically use C programming language and C++ programming language cannot be used?

1145


What is inheritance in simple words?

623


How do you achieve polymorphism?

608


Why do we use class in oops?

552






What is abstraction and encapsulation?

568


How oops is better than procedural?

583


What is overloading in oops?

596


Why multiple inheritance is not allowed?

581


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

1913


Can an interface inherit a class?

556


What is oops and its features?

580


What does I oop mean?

612


can inline function declare in private part of class?

3655


What are oops functions?

582