There is a base class sub, with a member function fnsub(). There are two classes super1 and super2 which are sub classes of the base class sub.if and pointer object is created of the class sub which points to any of the two classes super1 and super2, if fnsub() is called which one will be inoked?
Answer / Shubham Kaushik
"If a pointer to a base class object is pointing to a derived class object, when we call a member function that's present both in the base class and the derived class, the function from the derived class will be called. This is known as polymorphism."n
| Is This Answer Correct ? | 0 Yes | 0 No |
What is an abstract class?
Discuss about iteration statements in C++ .
What Is Polymorphism in C++ ?
3 Answers IBS, Impetus, ITC Indian Tobacco Company, Motorola,
Identify the errors in the following program. #include <iostream> using namespace std; void main() { int i=5; while(i) { switch(i) { default: case 4: case 5: break; case 1: continue; case 2: case 3: break; } i-; } }
How many times will this loop execute? Explain your answer.
What is the difference between malloc, calloc and realloc?
It is possible to build a C++ compiler on top of a C compiler. How would you do this?
Identify the error in the following program. include<iostream> using namespace std; void main() { int num[]={1,2,3,4,5,6}; num[1]==[1]num ? cout<<"Success" : cout<<"Error"; }
What is the difference between virtual functions and pure virtual functions?
Write a program to read the values a, b and c and display x, where x=a/b–c. Test the program for the following values: (a) a = 250, b = 85, c = 25 (b) a = 300, b = 70, c = 70
What do you know about Volatile keyword in C++? Explain with an example code.
What is function overloading and operator overloading in C++?