tangjun
February 19th, 2007, 11:25 AM
abstract class A
{
protected int m_nWidth;
public abstract void Compute();
...
}
class B : A
{
public override void Compute()
{
... using m_m ...
}
}
class C : A
{
public override void Compute()
{
... using m_m ...
}
}
Now I need to extend class A's behavier but still need A's data structure, also needs B and C's different implementation without rewrite B and C's code.
what's the best design for the new class(s)?
{
protected int m_nWidth;
public abstract void Compute();
...
}
class B : A
{
public override void Compute()
{
... using m_m ...
}
}
class C : A
{
public override void Compute()
{
... using m_m ...
}
}
Now I need to extend class A's behavier but still need A's data structure, also needs B and C's different implementation without rewrite B and C's code.
what's the best design for the new class(s)?