/* CSC 123/252 Object Oriented Programming Assignment Emulating Multiple Inheritance Java (and many similar languages such as C#, Kotlin, etc) permits only single inheritance. While you may implement multiple interfaces, you an only *extend* one class: class A extends B, C // not allowed. But we want to have multiple inheritance anyway! Recall that I managed to emulate inheritance in C. A "subclass" is just a struct that can also behave like its super-struct (we're only interested in public inheritance). We just need to store an instance of the "superclass" inside the subclass and rebuild the interface. Part I. Download and unzip the package javaasn.zip from https://cs.hofstra.edu/~cscccl/csc123/javaasn.zip The package contains the following setup: public interface Ia { // implemented by class A void f(); void g(); void h1(); } public interface Ib { // implemented by class B void f(); void g(); void h2(); } public class A implements Ia { ... } class B implements Ib { ... } /* You are to show how to construct a class class C extends A implements Ia, Ib That inherits from A but implements both interfaces by "faking" the additional inheritance from B. This class should inherit both h1 from A and h2 from B. FURTHERMORE, C MUST inherit f() from class A and g() from class B, so some overriding would be needed. Just outside the javaasn directory, create a C.java program with: import javaasn.A; import javaasn.B; import javaasn.Ia; import javaasn.Ib; import javaasn.A2; import javaasn.B2; public class C extends A implements Ia, Ib { ... } Your implementation must work with any implementation of class A and B. Decompiling the class files is strictly not allowed. Anyone who writes System.out.println statements in their code will lose 10000 points. This doesn't mean you can't define f, g and h1/h2 in your subclasses It means that you cannot copy the "System.out.println" code, because it really represents arbitrarily complex code. Your solution must work in general, regardless of how these functions are implemented. Write a main that calls all 4 functions, f, g, h1, and h2 on your C class. You can put the main inside the public C class. Part 2. This time there are no interfaces Ia, Ib to give you a clue. Instead you just know that there are class A2 and B2 */ public class A2 { protected void f() { /* ... */ } protected void g() { /* ... */ } protected void h1() { /* ... */ } } public class B2 { protected void f() { /* ... */ } protected void g() { /* ... */ } protected void h2() { /* ... */ } } /* Protected items are only visible to subclasses outside the package. Once again, you are to assume that the code in A2, B2 are generic and you may not just write println statements. Write a public class C2 that inherits all the functionality of A2 and B2, with the same stipulation that it should take f() from A2 and g() from B2. Hint: you may define other interfaces, classes to help you, but YOU MAY NOT CHANGE A2, B2. Hint: to call the superclass version of a function, call super.function(..) Unlike part 1, this time both inheritances may have to be emulated. Write a main that calls all methods on your subclass. */