Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //A class using the child class of the abstract class
- public class Rajat {
- //Using the child class of abstract class logic here itself for this example
- public Rajat() {
- //Since Male is a child of HealthAbstract class, the constructor of the Child class is called first and then also the constructor of Health Abstract class is called
- Male m = new Male();
- //Call methods of the Abstract class from its child class
- m.setWeight(70);
- System.debug('The weight is: '+m.getWeight());
- //Call the abstract method of abstract class implemented in child class
- System.debug('Workout Intensity should be: '+m.workoutIntensity(18, 46));
- }
- }
- //Call the above class in anonymous mode - Rajat obj = new Rajat(); should execute above code
Add Comment
Please, Sign In to add comment