protected string param { get; set; }
public BaseClass(string param) {
public virtual string getParam() {
public SomeThing(BaseClass bc) {
Console.WriteLine(bc.getParam());
public class Child1 : BaseClass {
public Child1(string param) : base(param) {}
public override string getParam() {
return "Overrided " + base.param;
public class Child2 : BaseClass {
public Child2(string param) : base(param) {}
public override string getParam() {
return "Second overrided " + base.param;
public static void Main()
SomeThing sth1 = new SomeThing(new BaseClass("lol"));
SomeThing sth2 = new SomeThing(new Child1("child 1"));
SomeThing sth3 = new SomeThing(new Child2("child 2"));