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 are the two different types of polymorphism?

664


Can destructor be overloaded?

587


i am getting an of the type can not convert int to int *. to overcome this problem what we should do?

1826


What is encapsulation with example?

568


Is react oop?

603






What do you mean by overloading?

570


What does it mean when someone says I oop?

572


What are the 3 pillars of oop?

607


What is a class oop?

584


What is balance factor?

572


What is meant by multiple inheritance?

728


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?

2742


What is an advantage of polymorphism?

583


What is cohesion in oop?

607


What is oops?what is its use in software engineering?

547