What are virtual functions?
Answers were Sorted based on User's Feedback
Answer / qapoo
A function is declared virtual in base class when u are
having same functions in both base and derived classes and
you want to access both the functions with same function
call and its done using base class pointer.
e.g
class base
{
public:
void show(){cout<<"hi"};
};
class derived:pubic base
{
public:
void show(){cout<<"bye";}
};
int main()
{
base *ptr;
base b;
derived d;
ptr=&b;
ptr->show();//base class fn is called
ptr=&d;
ptr->show();//derived class fn is called
return 0;
}
Is This Answer Correct ? | 7 Yes | 3 No |
Answer / nikhil kapoor
The function which supports run time polymorphysm is called
virtual function...
Is This Answer Correct ? | 3 Yes | 2 No |
What are classes oop?
What is the real life example of polymorphism?
what is pointers
can we make game by using c
What is the difference between inheritance and polymorphism?
Base class has two public data members. How can i derive a new class with one datamember as public and another data member as private?.
What is abstraction in oops?
OOP'S advantages of inheritance include:
what is the difference between inter class and abstract class...?
What is cohesion in oop?
What is multiple inheritance?
Explain the concept of abstracion and encapsulation with one example. What is the difference between them?