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 the difference between abstraction and polymorphism?
Can abstract class have normal methods?
Is enum a class?
Why is polymorphism important in oop?
given a set based questions and 5 questions based on it next data sufficiciency questions 2 and 2/3 english sentence completion with options very easy and 2 synononmys paragraph with 10 questions 10 minutes replace =,-,*,% with -,%,+,* type questions 5 3 questions lik following itssickhere itssickthere itssickhere istsickhere which is nt alike the others very easy
What is static in oop?
any one please tell me the purpose of operator overloading
What is the oops and benefits of oops programming?
Why is oop better than procedural?
Whats is abstraction in oops?
what is graphics
What is the problem with multiple inheritance?
Can a varargs method be overloaded?
What are the important components of cohesion?
Question: Write a program that prints a paycheck. Ask the program user for the name of the employee, the hourly rate, and the number of hours worked. If the number of hours exceeds 40, the employee is paid “time and a half”, that is, 150 percent of the hourly rate on the hours exceeding 40. Be sure to use stepwi se refine ment and break your solution into several functions. Use the int_name function to print the dollar amount of the check.