Assume that I have the following classes with a generic interface:
public class MyClass_1 : IGenericInterface
{
public void foo()
{
bar();
}
void bar()
{
...
}
}
public class MyClass_2 : IGenericInterface
{
public void foo()
{
bar();
}
void bar()
{
...
}
}
public interface IGenericInterface
{
void foo();
}
They both have the public "foo" function and it's implementation is the same as well. So I tend to move "foo" into an abstract, shouldn't I?
Now, the problem is, that they call a private function ("bar") which is a class specific implementation. How can I make this function "bar" kind of visible to the possibly generic implementation of "foo"?
E.g.
public abstract class MyGenericClass: IGenericInterface
{
public foo()
{
bar();
}
}
The goal then would be that the specific class inherit from the generic class:
public class MyClass_1 : GenericClass
{
private void bar()
{
...
}
}
public class MyClass_2 : GenericClass
{
private void bar
{
...
}
}