D
Q. What is the output of the following C++ code?
#include<iostream> using namespace std; class A { public: void show() { cout <<" show() method of class A"; } }; class B : public A { public: void show() { cout <<" show() method of class B"; } }; class C: public B { }; int main(void) { C c; c.show(); return 0; }
The show() method is not defined in the C class. It is therefore searched in the inheritance hierarchy. show() is present in both classes A and B, which one should be called? The idea is the following: if there is a multi-level inheritance, the function is then searched linearly in the inheritance hierarchy until a matching function is found.
You must be Logged in to update hint/solution
Be the first to start discuss.
Q. Which among the following is a mandatory condition for downcasting?
Q. What is the other name used for functions inside a
Q. Which of the following is the scope resolution operator?
Q. What is the output of the following C++ code?
Q. What is the output of following c++ program?
Q. What are the actual parameters in C++?
Q. Which header file is required to use file handling in C++?
Q. A base class is also known as class.
Q. _____ variable of the same data type can be declared in a single declaration statement.
Discusssion
Login to discuss.