Home > DeveloperSection > Blogs > Base Class Initilization

Base Class Initilization


C# C# 
Ratings:
0 Comment(s)
 1836  View(s)
Rate this:

using System;

using System.Collections.Generic;

using System.Text;

 

namespace ConsoleApplication2

{

    public class Program

    {

        public Program(int a, int b)

        {

            Console.WriteLine("This is [A] Method.....");

            Console.WriteLine(a + " " + b);

        }

 

        public void show()

        {

            Console.WriteLine("This will be call by base class....");

        }

    }

 

    public class Progrram2 : Program

    {

        public Progrram2()

            : base(10, 20)

        {

 

        }

 

        public void B()

        {

            base.show();

            Console.WriteLine("This is [B] Method.....");

        }

    }

 

    class right

    {

        public static void Main()

        {

            Progrram2 p2 = new Progrram2();

            p2.B();

        }

    }

}

 


Don't want to miss updates? Please click the below button!

Follow MindStick