• Object-oriented Design: Explain and demonstrate the concept of Inheritance and Polymorphism using the following pseudo Java / C# / C++ example:
o Base Class: Class A, has method “print” that outputs “Class A”
o Derived Class: Class B : A, has method “print” that outputs “Class B”
o Java / C#
 A Instance1; Instance1 = new A (); Instance1.print() // output = ?
 A Instance2; Instance2 = new B (); Instance2.print() // output = ?
 A Instance3; Instance3 = (A) new B (); Instance3.print() // output = ?
------解决方案--------------------
 A Instance1; Instance1 = new A (); Instance1.print() // output = “Class A”
 A Instance2; Instance2 = new B (); Instance2.print() // output = “Class B”
 A Instance3; Instance3 = (A) new B (); Instance3.print() // output = “Class B”