Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. 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. 2.Implement a derived type Hydrogen that inherits from Atom and provides the correct arguments for protons and electrons to the base constructor.
  3.  
  4.  
  5. public class Atom
  6. {
  7. public int Protons { get; set; }
  8.  
  9. public int Electrons { get; set; }
  10.  
  11. public Atom(int protons, int electrons)
  12. {
  13. Protons = protons;
  14. Electrons = electrons;
  15. }
  16.  
  17. }
  18.  
  19. public class Hydrogen : Atom
  20. {
  21. public Hydrogen() : base("Atom") { }
  22. }
  23.  
  24. public class Program
  25. {
  26. public static void Main()
  27. {
  28.  
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement