Answer Posted / danish afzal
Virtual is important part of polymorphism,and if a function of a base class is virtual we can use or override it in drived classes.
class base
{
virtual void foo() const
{
cout << "danish B";
}
};
class derived1 :public base
{
void foo() const
{
cout << "danish D1";
}
};
class derived2 :public base
{
void foo() const
{
cout << "danish D2";
}
};
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
What is polymorphism and its types?
What is this pointer in oop?
Explain the concepts involved in Object Oriented programming.
Why is oop better than procedural?
Whats oop mean?
can inline function declare in private part of class?
What is static in oop?
Get me an image implementation program.
What are main features of oop?
What is a class and object?
Why do we need polymorphism in c#?
How to handle exception in c++, For example in a functions i am assigning memory to some variables and also in next instructions in am dividing one variable also. If this functions generates a error while allocating memory to those variable and also while dividing the variable if i divide by zero then catch block how it will identify that this error has cone from perticular instruction
What is persistence in oop?
Why is polymorphism used?
How Do you Code Composition and Aggregation in C++ ?