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
why reinterpret cast is considered dangerous?
What does and I oop and sksksk mean?
How to use CMutex, CSemaphore in VC++ MFC
Why is abstraction needed?
What type of loop is a for loop?
Can enum be null?
What is advantage of inheritance?
Which type does string inherit from?
What is object in oops?
How can you overcome the diamond problem in inheritance?
what is graphics
write a program to enter a string like"sunil is a good boy and seeking for a job" not more than 10 characters including space in one line,rest characters should b in other line.if the next line starts from in between the previous word,then print whole word to next line.
What are different oops concepts?
What is oops and its features?
what are the ways in which a constructors can be called?