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 a Polymorphism? How many types of polymorphism and whats that use in application?
What are benefits of oop?
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?
Can you name some types of inheritance?
What is the difference between C++ and java?
What is OOPS and How it is different from Procedural Programming ?
23 Answers HP, Infosys, Thyrocare,
What is encapsulation?
why in java first invoke public static void main(String args[]) method????Why not public static void method1(String args[])??
inheritence with example
Please tell me the oops concept with detailed answer
Why do we use oops?
What is the fundamental idea of oop?