Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication3
  7. {
  8.     class Main
  9.     {
  10.  
  11.         static void Main(string[] args)
  12.         {
  13.             Baiat m = new Baiat();
  14.             Console.WriteLine(m.toString1());
  15.         }
  16.     }
  17. }
  18.  
  19. public class Copil
  20. {
  21.     private int age = int.Parse(Console.ReadLine(age));
  22.     private int height = int.Parse(Console.ReadLine(height));
  23.  
  24.     public Copil(int a, int h)
  25.     {
  26.         this.age = a;
  27.         this.height = h;
  28.     }
  29.     public String toString()
  30.     {
  31.         Console.WriteLine("Copilul are varsta: " + age + " si inaltimea de: " + height);
  32.     }
  33. }
  34.  
  35. public class Baiat : Copil
  36. {
  37.     private String sex=Console.ReadLine();
  38.    
  39.     public String toString1()
  40.     {
  41.         Console.WriteLine( "Copilul are varsta: " + age + " si inaltimea de: " + height + "si sexul: " + sex);
  42.     }
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement