Inheritance

Exercise: Create a constructor

Goal

  1. Create a constructor on the base type Atom that accepts an integer named protons and an integer electrons. The constructor should set the values to the associated properties Protons and Electrons.
  2. Implement a derived type Hydrogen that inherits from Atom and provides the correct arguments for protons and electrons to the base constructor.
Page 11 of 18