how I can use Override Specifier (link); Lambda function (link); List Initialization (link); inside my code:
Code:
#include <vector>
class Shape
{
public:
virtual void display() = 0;
};
class Rectangle : public Shape
{
public:
virtual void display()
{
// Implementation, not relevant
}
};
int main(int argc, char[] argv)
{
std::vector<Shape*> shapeList;
shapeList.push_back(new Rectangle);
shapeList.push_back(new Rectangle);
shapeList.push_back(new Rectangle);
shapeList.push_back(new Rectangle);
shapeList.push_back(new Rectangle);
shapeList.push_back(new Rectangle);
for (auto shapeList.begin(); it != shapeList.end(); it++)
{
(*it)->display();
}
return 0;
}