C#

Single Inheritance using C# Language.

Single Inheritance using C# Language.
using System;

public class base1

  {

    public int i;

    public int j;

    public void one()

         {     

            Console.WriteLine("\nBase Value : {0}",(i+j));  

         }

   }



public class deriv1 : base1

   {

     public int k;

     public void two()

       {   

          Console.WriteLine("\nDerived value : {0}",k);   

       }



      public void three()

       {    

          Console.WriteLine("\nDerived Value : {0}",(i+j+k));   

       }

   }



public class exam

  {

     public static void Main()

       {

           deriv1 t = new deriv1();

           t.i=5; 

           t.j=10;

           t.k=15;  

           t.one();

           t.two();

           t.three();

       }

 } 
Senthilvelan Sambamoorthy

Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.