Instead of inheriting from a base class and method overriding like here:
public class MyClass:BaseClass
public override void Foo()
You add the class variable of a given class and calls it's method if needed.
public class MyClass
private BaseClass _baseClass = new BaseClass();
public void Foo()
More about the comparison between Inheritance and Composition you can find here. Take a closer look at the table at the end of article.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.