#include <iostream>
using namespace std;
class Shape
{
virtual void show() = 0;
};
class Circle: public Shape
{
void show()
{
std::cout<<"Circle\n";
}
};
class Triangle: Shape
{
void show()
{
std::cout<<"Triangle\n";
}
};
int main(int argc, char* argv[])
{
Shape* shape1;
shape1 = new Circle();
shape1->show();
Shape* shape2 = new Triangle();
shape2->show();
delete shape1;
delete shape2;
return 0;
}
Login in to like
Login in to comment