Question
Please explain: What has been achieved in terms of functionality, i.e what action/call or operation can I perform after dynamic casting? Do Base*b or Derived*
Please explain:
What has been achieved in terms of functionality, i.e what action/call or operation can I perform after dynamic casting?
Do Base*b or Derived* d have become more capable in any sense?
Please explain any thing that I is achieved after dynamic cast and was not possible otherwise.
code for ref:
#include
using namespace std;
class Base {
public:
virtual void print() {}
};
class Derived : public Base {
public:
void print2(){
cout
}
};
int main() {
Base* b = new Derived;
Derived* d = dynamic_cast
if (d != NULL) {
cout
}
else {
cout
}
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started