Answer Posted / b.balaganesan
Virtual, as the name implies, is something that exists in
effect but not in reality. The concept of virtual function
is the same as a function, but it does not really exist
although it appears in needed places in a program. The
object-oriented programming language C++ implements the
concept of virtual function as a simple member function,
like all member functions of the class.
Need for Virtual Function:
The vital reason for having a virtual function is to
implement a different functionality in the derived class.
For example: a Make function in a class Vehicle may have to
make a Vehicle with red color. A class called FourWheeler,
derived or inherited from Vehicle, may have to use a blue
background and 4 tires as wheels. For this scenario, the
Make function for FourWheeler should now have a different
functionality from the one at the class called Vehicle.
This concept is called Virtual Function.
| Is This Answer Correct ? | 10 Yes | 3 No |
Post New Answer View All Answers
What is polymorphism used for?
What is the purpose of polymorphism?
What is encapsulation in ict?
What is class and example?
Write A Program to find the ambiguities in Multiple Inheritance? How are they resolved.(Virtual Functions)
Why do we use inheritance?
What is the difference between procedural programming and oops?
is there any choice in opting subjects like 4 out of 7
Can we have inheritance without polymorphism?
What are different types of JVM's? for example we use dalvik jvm for android then what about the remaining operating systems?
What is meant by multiple inheritance?
How does polymorphism work?
write a program using c++ to implement single contiguous memory mangement techniques.display the content of the main memory after yhe allocation of jobs and percentage of the wastage of the main memory
#include
What is meant by oops concept?