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

Why pointer is used in c++?

627


Can I create my own functions in c++?

615


Can c++ be faster than c?

614


Describe linked list using C++ with an example.

663


Why c++ is created?

590






What is c++ best used for?

575


Which command properly allocates memory a) char *a=new char[20]; b) char a=new char[20]; c) char a=new char(20.0);

625


How are Structure passing and returning implemented by the compiler?

606


What are the uses of c++ in the real world?

577


What do you mean by a template?

636


Why do we use string in c++?

522


What are punctuators in c++?

663


Define what is constructor?

596


What is an overflow error?

632


What is the basic structure of a c++ program?

630