A
Andy Meyer
Hi all,
I'm converting some C++ Controls to C# and there's one big thing, that
I can't solve:
class CControlEx
{
int nDescriptionID;
CString strDescription;
public:
//works with nDescriptionID & strDescription
void DoSomething();
};
with this class I create the following
class CComboBox2 : public CComboBox, CControlEx
{
...
};
class CEdit2 : public CEdit, CControlEx
{
...
};
....
The advantage is that I have to code the logic for DoSomething in all
of my derivations only once.
In C# I use interfaces and it works fine, but is there a workaround,
so that I don't have to code the same thing for DoSomething in all of
my classes?
Attributes and Reflection aren't a solution, because the values of
nDescriptionID and strDescription may change at runtime.
Thanks in advance
Andy
I'm converting some C++ Controls to C# and there's one big thing, that
I can't solve:
class CControlEx
{
int nDescriptionID;
CString strDescription;
public:
//works with nDescriptionID & strDescription
void DoSomething();
};
with this class I create the following
class CComboBox2 : public CComboBox, CControlEx
{
...
};
class CEdit2 : public CEdit, CControlEx
{
...
};
....
The advantage is that I have to code the logic for DoSomething in all
of my derivations only once.
In C# I use interfaces and it works fine, but is there a workaround,
so that I don't have to code the same thing for DoSomething in all of
my classes?
Attributes and Reflection aren't a solution, because the values of
nDescriptionID and strDescription may change at runtime.
Thanks in advance
Andy