Hi,
In below design a big problem is whenever DoSomething() signature is changed to introduce new functionality caller class (return m.DoSomething()) also needs to be changed which might not be aware of this change. kindly suggest good design to get rid of this flaw.
class MyOtherClass {
int m;
public:
MyOtherClass(int x) : m(x) { }
int DoSomething() { return m + 1; }
};
class MyClass {
MyOtherClass m;
public:
MyClass() : m(42) { }
int DoSomething() { return m.DoSomething(); }
};