Create a hierarchy of classes A, B and C so that the code below compiles and displays the text "ABC"
static void Main(string[] args) { var b = new B(); var c = new C(); ((A)c).PrintMessage(); ((A)b).PrintMessage(); c.PrintMessage(); }
Tell me how to build inheritance correctly, but I’m constantly catching
System.InvalidCastException