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 |
i hav very low percentage in 12th n BSCwhich is around 50.......coz it was just imposed on me 2 b a science graduate,nw m doin MCA n hav aggregate 74% ....what shud i answer if company's HR ask me about dis much low previous percentage??????
What is a class?
32 Answers Infosys, TCS, Thylak,
difine hierarchical inheritance.
what is new operator in c++
What is abstraction in oop?
Can static class have constructor?
what are abstract classes and how they impliment , with example
How to hide the base class functionality in Inheritance?
Program to read a comment string
what is cast operator?
when my application exe is running nad i don't want to create another exe what should i do
What is this pointer in oop?