D
DeMarcus
Hi,
I have an object, let's call it HydraulicPress
class HydraulicPress
{
public:
void setIron( Iron* iron ) const;
Iron* getIron( void ) const;
void pressIron( void ) const;
private:
mutable Iron* iron;
};
Notice the const at setIron()! That's because I want to be able to use
a HydraulicPress as a const object, meanwhile it operates on a different
object Iron. I can't omit the get/set-methods since the press and iron
will be tight coupled for a while.
Is this bad design? Is there anyone who recognize this design problem
and could recommend some similar design pattern or way of thinking?
Best Regards
Daniel Marcus
I have an object, let's call it HydraulicPress
class HydraulicPress
{
public:
void setIron( Iron* iron ) const;
Iron* getIron( void ) const;
void pressIron( void ) const;
private:
mutable Iron* iron;
};
Notice the const at setIron()! That's because I want to be able to use
a HydraulicPress as a const object, meanwhile it operates on a different
object Iron. I can't omit the get/set-methods since the press and iron
will be tight coupled for a while.
Is this bad design? Is there anyone who recognize this design problem
and could recommend some similar design pattern or way of thinking?
Best Regards
Daniel Marcus