What is virtual class and friend class?

Answer Posted / vaibhav panchal

A virtual class is an inner class that can be overridden by
derived classes of the outer class.

eg.
class Base
{
public:
int value
};
class child1 : public Base { };
class child2 : public Base { };
class grandchild : virtual public child1, virtual public
child2
{
public:
grandchild() { value };
};

Is This Answer Correct ?    38 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is polymorphism in oops with example?

525


What is Difeerence between List obj=new ArrayList(); and ArrayList obj=new ArrayList()?

2098


Why is object oriented programming so hard?

612


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

24187


What does enum stand for?

607






What is destructor in oop?

621


Can main method override?

583


What are constructors in oop?

587


What is Difference Between Inheritance and creating object and getting data? means Class A extends B{ B.getMethod();} (OR) Class A{ b obj=new B(); obj.getMethod(); }

1978


What are the 3 principles of oop?

614


hi, this is raju,iam studying b.tech 2nd year,iam want know about group1 and group2 details, and we can studying without going to any instutions? please help me.

1537


What is encapsulation oop?

574


What is inheritance in simple words?

623


What is the point of polymorphism?

582


Advantage and disadvantage of routing in telecom sector

782