Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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.
- public class Atom
- {
- public int Protons { get; set; }
- public int Electrons { get; set; }
- public Atom(int protons, int electrons)
- {
- Protons = protons;
- Electrons = electrons;
- }
- }
- public class Hydrogen : Atom
- {
- public Hydrogen() : base("Atom") { }
- }
- public class Program
- {
- public static void Main()
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement