Advertisement
Guest User

clcbx

a guest
Apr 30th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. public class Test
  5. {
  6. class Human {
  7. public string Name {get;set;}
  8. public int Power{ get;set;}
  9.  
  10.  
  11. public Human( string name,int power) {
  12. Name=name;
  13. Power=power;
  14. }
  15. public void print () {
  16. Console.WriteLine("Name;"+Name);
  17. Console.WriteLine("Power:"+Power);
  18. }
  19.  
  20.  
  21.  
  22. }
  23.  
  24. class Baby:Human{
  25. private int power;
  26. public Baby (int power,string name):base(name,power) {
  27.  
  28. print();
  29.  
  30. }
  31.  
  32. }
  33.  
  34. public static void Main()
  35. {
  36. List<Human> Humans=new List<Human>();
  37. add.Humans(44,"Doom"));
  38.  
  39. foreach(Human human in Humams) {
  40. Console.WriteLine(Humans.Name);
  41. }
  42.  
  43.  
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement