Answer Posted / danish afzal
Virtual is important part of polymorphism,and if a function of a base class is virtual we can use or override it in drived classes.
class base
{
virtual void foo() const
{
cout << "danish B";
}
};
class derived1 :public base
{
void foo() const
{
cout << "danish D1";
}
};
class derived2 :public base
{
void foo() const
{
cout << "danish D2";
}
};
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
How can you overcome the diamond problem in inheritance?
What is polymorphism what is it for and how is it used?
What is inheritance in simple words?
Why is oop useful?
What is the diamond problem in inheritance?
Why do we use class?
What is encapsulation and abstraction? How are they implemented in C++?
What is for loop and its syntax?
class type to basic type conversion
explain sub-type and sub class? atleast u have differ it into 4 points?
Hi friends I have experience of 6 months in website design and maintanence. Now i am looking for other IT jobs.. to switch platform. please post any interview you know in chennai.
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.
Which language is pure oop?
What is a class in oop?
What are functions in oop?