The covariant overriding examples

Read the comments inside Main.java and MyComplexNumber.java for modifying the code to see how the covariant overriding feature allows a simpler and cleaner code.

  1. Main.java — the root program

  2. MyNumber.java — the base class (needs no modification)

  3. MyComplexNumber.java — the derived class which (may not) take advantage of the covariant overriding