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 the default access level?

623


List the types of polymorphism in c++?

627


How do you clear a buffer in c++?

540


Is c++ map a hash table?

567


Array base access faster or pointer base access is faster?

1817






When is the destructor called?

607


What header file is needed for exit(); a) stdlib.h b) conio.h c) dos.h

614


What is flush () in c++?

578


Which recursive sorting technique always makes recursive calls to sort subarrays that are about half size of the original array?

613


What is the difference between while and do while loop? Explain with examples.

601


What is the correct syntax for inheritance a) class aclass : public superclass b) class aclass inherit superclass c) class aclass <-superclass

689


If a base class is an adt, and it has three pure virtual functions, how many of these functions must be overridden in its derived classes?

592


What are the advantages of inheritance in c++?

657


what do you mean by volatile variable?

586


What is the real purpose of class – to export data?

616