Map of Parent Type and calling child type copy constructor

B

Brandt Dusthimer

Hi. I'm try to construct a map<int, Shape> so that I can keep a list of
Shapes. Here's a simplified version of my code so far:

Shape
{

};
 
M

mlimber

Brandt said:
Hi. I'm try to construct a map<int, Shape> so that I can keep a list of
Shapes. Here's a simplified version of my code so far:

Shape
{

};

Nothing wrong with it so far. Keep up the good work!

Cheers! --M
 
S

shadowman615

Brandt said:
Hi. I'm try to construct a map<int, Shape> so that I can keep a list of
Shapes. Here's a simplified version of my code so far:

Shape
{

};

They say true simplicity is genius!
 
T

Thomas Tutone

mlimber said:
Nothing wrong with it so far. Keep up the good work!


Really? Shouldn't it at least be "class Shape {};" ? Or "struct Shape
{};" ?

Best regards,

Tom
 
J

Jim Langston

Brandt Dusthimer said:
Hi. I'm try to construct a map<int, Shape> so that I can keep a list of
Shapes. Here's a simplified version of my code so far:

Shape
{

};

Well, I would say that was pretty simple. It won't even compile. Try this.

#include <map>

class Shape
{
};

int main()
{
std::map< int, Shape > ShapeMap;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top