Guest User

Untitled

a guest
Oct 23rd, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.59 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8.     class A
  9.     {
  10.         int value = 5;
  11.         public int prop
  12.         {
  13.             get { return value; }
  14.             set { this.value = value; }
  15.         }
  16.     }
  17.     class B : A
  18.     {
  19.         public B()
  20.         {
  21.             prop = 10;
  22.         }
  23.     }
  24.     class Program
  25.     {
  26.         static void Main(string[] args)
  27.         {
  28.             A myclass = new B();
  29.             Console.WriteLine(myclass.prop);
  30.             Console.ReadKey();
  31.         }
  32.     }
  33. }
Add Comment
Please, Sign In to add comment