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 does and I oop mean in text?
What is an example of genetic polymorphism?
What is the real time example of encapsulation?
What is the difference between procedural programming and oops?
What is coupling in oop?
Plese get me a perfect C++ program for railway/airway reservation with all details.
Why do we use inheritance?
Give an example where we have to specifically use C programming language and C++ programming language cannot be used?
What does and I oop and sksksk mean?
Why is abstraction needed?
What is oops concept with example?
when to use 'mutable' keyword and when to use 'const cast' in c++
Why is destructor used?
What is overloading in oops?
what is graphics