what is a virtual class?

Answer Posted / ramakrishna

It is used to avoid the ambiguity problem in c++ (multiple
inheritance).
when sub class inherits same members from 2 base classes.
compiler dont know which variable has assigned the value.

If u declare the class as virtual only one time is
inherited in its derived class.A copy will never get
inherited.
concept of virtual methods is different purpose.
like how we have abstract key word in java,we can acheive
method abstraction using virtual keyword before a method.

please select no if u really know this answer is wrong.
people with out having knowlede saying simple know hurts
the technical world.
Regards,
Ramakrishna Yechuri
sr corporate Trainer
yrk_in@yahoo.com

Is This Answer Correct ?    6 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is difference between class template and template class?

2398


What is balance factor?

818


What is protected in oop?

811


Hi friends I have experience of 6 months in website design and maintanence. Now i am looking for other IT jobs.. to switch platform. please post any interview you know in chennai.

1978


What is the difference between abstraction and polymorphism?

848


How to call a non virtual function in the derived class by using base class pointer

5909


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

1985


What is interface in oop?

881


What is abstraction in oop with example?

857


What does sksksk mean in text slang?

1838


What is an advantage of polymorphism?

821


Why multiple inheritance is not allowed?

818


How Do you Code Composition and Aggregation in C++ ?

24717


write a C++ program for booking using constructor and destructor.

2265


What is persistence in oop?

867