Q:

Single Inheritance using C# Language

0

This Program is used to calculate the number using single inheritance concept

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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();

       }

 } 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now