What is virtual class and friend class?
Answers were Sorted based on User's Feedback
Answer / kirti joshi
friend class is used to share private data between 2 or
more classes the function declared as freind are not called
using any object it is called like normal .the arguments to
such functions is normally object of a class.
virtual class is used for run time polymorphism when object
is linked to procedure call at run time
| Is This Answer Correct ? | 53 Yes | 7 No |
Answer / 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 |
Answer / vaibhav panchal
A virtual class is an inner class that can be overridden by
derived classes of the outer class.
| Is This Answer Correct ? | 27 Yes | 7 No |
Answer / guest
frien class are used when two or more classes are designed
to work together and virtual base class aids in multiple
inheritance
| Is This Answer Correct ? | 33 Yes | 17 No |
Answer / govind
A virtual class is an inner class that can be overridden by
derived classes of the outer class.buti in this virtual
class cant access the privat member data and funtion .
A friend class is can access the privat member data and
function .
| Is This Answer Correct ? | 14 Yes | 3 No |
i^=j; j^=i; i^=j; value of i,j
what does exactly the linker do?
What is the difference between pass by reference and pass by value?
What is an object?
Following are the class specifications: class {int a}; class {int b}; Using friend funtion,calculate the max of two objects and display it.
what type of questions
how to swap to variables without using thrid variable in java?
write string class as your own class in java without using any built-in function
What are functions in oop?
What is inheritance in oop?
what is the drawback of classical methods in oops?
What is the correct syntax for inheritance? 1) class aclass : public superclass 2) class aclass inherit superclass 3) class aclass <-superclass