Skip to content
Advertisement

What is the Java way to apply inheritance in this particular problem?

I have two classes A and B and I have one email generating script.

In python, the code would look something like

JavaScript

This doesn’t work for Java as it is strongly-typed. How can I implement this in java?

Edit: Here are the A (Student) and B (Teacher) classes:

JavaScript

Here is the processing and generating email class for A.

JavaScript

I need to create a similar report generating method for teachers but the attributes differ so I needed help with that.

Advertisement

Answer

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement