2b. (ii). Inheritance (all types)

Program:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Practical2.b2

{
class Program

{
public class  A
{

private  int value = 10;

public  class B : A
{
public int GetValue()
{
return this.value;

}


}
}

public class  C : A
{
//        public int GetValue()
//        {

//               return this.value;
//        }

}

public class  Example
{
public  static void Main(string[] args)
{
var b = new  A.B();

Console.WriteLine(b.GetValue());

Console.ReadKey();

}

}
}
}

Comments