// @topic T090m12d04x30 inheritance and virtual functions // @brief main driver code #include <iostream> #include <cstdlib> #include <vector> #include "shapes.h" int main() { std::cout << "sizeof( Shape )" << sizeof( Shape ) << "\n"; // Rectangle rectangle; // rectangle.compute_center(); // Circle circle{ 5, 5, 30 }; std::vector< std::unique_ptr< Shape > > shapes; shapes.push_back( std::unique_ptr< Shape >( new Circle{ 5, 5, 30 } ) ); shapes.push_back( std::unique_ptr< Shape >( new Rectangle ) ); shapes.push_back( std::unique_ptr< Shape >( new Circle{ 5, 5, 30 } ) ); shapes.push_back( std::unique_ptr< Shape >( new Rectangle ) ); for ( std::unique_ptr<Shape> const& pshape : shapes ) { pshape->draw(); } system("pause"); return 0; }