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
what are the different types of qualifier in java?
What do you mean by Encapsulation?
Can we define a class within the interface?
Why is abstraction used?
What is polymorphism in oop example?
What is polymorphism and example?
What are constructors in oop?
What is the real life example of polymorphism?
Explain the concepts involved in Object Oriented programming.
Can bst contain duplicates?
Write a program to compute for numeric grades for a course. The course records are in a file that will serve as the input file. The input file is in exactly the following format: Each line contains a student's first name, then one space, then ten quiz scores all on one line. The quiz scores are in whole number and are separated by one space. Your program will take it input from this file and sends it output to a second file. The data in the output file will be exactly the same as the data in the input file except that there will be one additional number (of type double) at the end of each line. This number will be the average of the student's ten quiz scores. Use at least one function that has file streams as all or some of its arguments.
Why do we use oop?
What is the oops and benefits of oops programming?
What is the full form of oops?
How to call a non virtual function in the derived class by using base class pointer