K
K Viltersten
Suppose there is the following class structure.
class S {...}
class A : S {...}
class B : S {...}
class A1 : A {void m(){...}}
class B1 : B {void m(){...}}
class B2 : B {...}
Just to clarify the issue. A1 and B1 share a
method (void m() ) AND B2 doesn't have that
method. Hence, it shouldn't be placed in any
of the extended classes S, A nor B.
Still, i feel that i'd like to put the method
in a common repository/class/whatever, to
avoid repetition and make the changes to it
simpler (only one copy needs to be edited).
It also makes the code less prone to errors.
Can it be done in C#? What would be a smart
solution for it?
class S {...}
class A : S {...}
class B : S {...}
class A1 : A {void m(){...}}
class B1 : B {void m(){...}}
class B2 : B {...}
Just to clarify the issue. A1 and B1 share a
method (void m() ) AND B2 doesn't have that
method. Hence, it shouldn't be placed in any
of the extended classes S, A nor B.
Still, i feel that i'd like to put the method
in a common repository/class/whatever, to
avoid repetition and make the changes to it
simpler (only one copy needs to be edited).
It also makes the code less prone to errors.
Can it be done in C#? What would be a smart
solution for it?