Guest User

Untitled

a guest
Jun 19th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. //A class using the child class of the abstract class
  2. public class Rajat {
  3.  
  4. //Using the child class of abstract class logic here itself for this example
  5. public Rajat() {
  6. //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
  7. Male m = new Male();
  8. //Call methods of the Abstract class from its child class
  9. m.setWeight(70);
  10. System.debug('The weight is: '+m.getWeight());
  11. //Call the abstract method of abstract class implemented in child class
  12. System.debug('Workout Intensity should be: '+m.workoutIntensity(18, 46));
  13. }
  14. }
  15.  
  16. //Call the above class in anonymous mode - Rajat obj = new Rajat(); should execute above code
Add Comment
Please, Sign In to add comment