What are virtual functions and what is its use?

Answer Posted / hrpynux@gmail.com

A virtual function is a member function that you expect to be redefined in derived classes. When you refer to a derived class object using a pointer or a reference to the base class, you can call a virtual function for that object and execute the derived class's version of the function.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is an iterator class in c++?

857


Is c++ a programming language?

800


What is atoi?

737


Explain the difference between class and struct in c++?

806


How to give an alternate name to a namespace?

793


Explain function overloading and operator overloading.

822


Explain rtti.

784


Can recursive program be written in C++?

900


Can c++ be faster than c?

792


What is an iterator?

924


What is difference between c++ 11 and c++ 14?

766


Explain what is class definition in c++ ?

800


What would happen on forgetting [], while deallocating an array through new?

838


What is the default width for ouputting a long integer using the insertion operator?

962


What will happen if a pointer is deleted twice?

936