J
Jayden Shui
Hello All,
I have a system with a number of classes developed well. Now I want to
add a name attribute to classes for input data. It gives each object a
name for identification, which provide users convenience in input. The
names will not affect the operation of the system. I don't want change
existing code a lot. I am thinking using template such as
template<class T>
class Named : public T
{
public;
// Get or Set name method.
private:
string mName;
};
But if class B is derived from A, Named<B> is not derived from
Named<A>. This may give some problems.
Any good way to do it? I appreciate your kind help.
Best regards,
Jayden
I have a system with a number of classes developed well. Now I want to
add a name attribute to classes for input data. It gives each object a
name for identification, which provide users convenience in input. The
names will not affect the operation of the system. I don't want change
existing code a lot. I am thinking using template such as
template<class T>
class Named : public T
{
public;
// Get or Set name method.
private:
string mName;
};
But if class B is derived from A, Named<B> is not derived from
Named<A>. This may give some problems.
Any good way to do it? I appreciate your kind help.
Best regards,
Jayden