You have one base class virtual function how will call that
function from derived class?
Answer Posted / narendra
class A
{
public:
virtual void fun()
{
cout<<"class A\n";
}
};
class B:public A
{
public:
virtual void fun()
{
cout<<"class B\n";
A::fun(); //calling base class virtual function.
}
};
| Is This Answer Correct ? | 4 Yes | 2 No |
Post New Answer View All Answers
What makes a language oop?
What is coupling in oop?
What are the benefits of polymorphism?
Why do we use class in oops?
What is class in oop with example?
What are the three parts of a simple empty class?
How to call a non virtual function in the derived class by using base class pointer
What is meant by multiple inheritance?
What are the advantages of polymorphism?
What are the 3 pillars of oop?
Which language is not a true object oriented programming language?
What is encapsulation in oop?
Why multiple inheritance is not possible?
What are the 4 pillars of oop?
class CTest { public: void someMethod() { int nCount = 0; cout << "This is some method --> " << nCount; } }; int main() { CTest *pctest; pctest->someMethod(); return 0; } It will executes the someMethod() and displays the value too. how is it possible with our creating memory for the class . i think iam not creating object for the class. Thanks in Advance... Prakash