What are Virtual Functions? How to implement virtual
functions in "C" ?

Answer Posted / rama

When we use the same function name in both the base and the
derived classes, the function in base class is declared as virtual...we must access virtual function through the use of a pointer declared as a pointer to the base class..


In other words, virtual function is defined in the base class,it need not be necessarily redefined in the derived class. In such cases,the respective calls will invoke the base class function.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of setfill in c++?

792


If you don’t declare a return value, what type of return value is assumed?

736


What does getch() do according to the ANSI C++ standard a) Reads in a character b) Checks the keyboard buffer c) Nothing in particular (Its not defined there)

791


What is the importance of mutable keyword?

790


What are c++ tokens?

800


Difference between declaration and definition of a variable.

882


What do you mean by “this” pointer?

795


Write a function to find the nth item from the end of a linked list in a single pass.

744


When do you call copy constructors?

870


Can you pass an array to a function in c++?

739


What is the best c++ compiler?

782


Why cstdlib is used in c++?

781


What is the use of data hiding?

772


What is the two main roles of operating system?

725


Define the process of handling in case of destructor failure?

777