MCQs>IT & Programming>C++>Output of the given code? #include struct shape { virtual void move() { std::cout << 'shape::move\n'; } }; struct circle : public shape { void move() { std::cout << 'circle::move\n'; } }; struct rectangle : public shape { void move() { std::cout << 'rectangle::move\n'; } }; int main() { shape *s; s = new shape(); s->move(); s = new circle(); s->move(); s = new rectangle(); s->move(); return 0; }
C++ MCQs
Given this code, what is the output? #include struct shape { virtual void move() { std::cout << "shape::move\n"; } }; struct circle : public shape { void move() { std::cout << "circle::move\n"; } }; struct rectangle : public shape { void move() { std::cout << "rectangle::move\n"; } }; int main() { shape *s; s = new shape(); s->move(); s = new circle(); s->move(); s = new rectangle(); s->move(); return 0; }