I have
struct Geometry_Base
{
//snipped data
virtual unsigned char GetID(){return 0u;}
}
struct Geometry_Child : Geometry_Base
{
//snipped data
unsigned char GetID() override {return 1u;}
}
struct Cell
{
//snipped
Geometry_Base geometry;
}
Then later on I do:
Geometry_Child child;
Cell cell;
cell.geometry = child;
unsigned char ID = cell.geometry.GetID();
This copies all the data over from child to cell.geometry, but the function being called is that of the base class. What is it that I'm doing wrong?