What prints when this code is run?
#include
#include
using namespace std;
class Shape { public: virtual void iam() const; };
class Square : public Shape { public: void iam() const; };
class Oval: public Shape { public: void iamm() const; };
void Shape iam() const { cout << "Shape"; }
void Square iam() const { cout << "Square"; }
void Oval iamm() const { cout << "Oval"; }
void iam(const Shape* s) { s->iam(); }
int main() {
Shape *a = new Shape, *b = new Square, *c = new Oval;
iam(a);
iam(b);
iam(c);
}
ShapeShapeOval
ShapeSquareOval
Does not compile ShapeShapeShape
ShapeSquareShape