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 is the importance of oop?
What is object in oop with example?
what is main difference between object oriented object base
what is the sylabus for priliminaries?
What are the benefits of oop?
Get me a number puzzle game-program
Which is the only operator in C++ which can be overloaded but NOT inherited?
Describe these concepts: Polymorphism, Inheritance and Abstraction.
String = "C++ is an object oriented programming language.An imp feature of oops is classes and objects".Write a pgm to count the repeated words from this scenario?
What is the difference between Home and $Home?
WAP to generate 2n+1 lines of the following pattern on the computer screen:
Which is the parameter that is added to every non-static member function when it is called?