Runtime Display Resolution

You are given a base class Base.

  • Create a virtual function show() that prints "Base show function called" (without quotes).

You are also given a derived class Derived that inherits from Base.

  • Override the show() function in Derived to print "Derived show function called" (without quotes).

Your task is to:

  • Demonstrate runtime polymorphism by using a base class pointer to call the show() function.
  • Perform all operations inside the Solution class.
  • Return the base class pointer pointing to the derived object.

Constraints:

  • No input is required
0
class Base {
public:
//your code goes here
};
 
class Derived : public Base {
public:
//your code goes here
};
 
class Solution {
public:
Base* solve() {
//your code goes here
}
};
Test Case

Input:

Input