|
12-03-2014
|
43
|
|
Software Engineer
Join Date: Sep 2011
Location: Gold Coast, Australia
Posts: 787
|
PHP Code:
List<Shape> shapes = List;
shapes.add( Circle( x, y, radius ) )
shapes.add( square( x1, y1, x2, y2, x3, y3, x4, y4) )
shapes.add( triangle( x1, y1, x2, y2, x3, y3 ) )
|
That won't compile.
Also if you're looking for a basic dynamic array type, they're called std::vector's in c++.
PHP Code:
std::vector<Shape> shapes;
shapes.push_back(Circle(x, y, radius))
shapes.push_back(Square(x1, y1, x2, y2, x3, y3, x4, y4))
shapes.push_back(Triangle(x1, y1, x2, y2, x3, y3))
|
|
|
|