blog

Home / DeveloperSection / Blogs / Base Class Initilization

Base Class Initilization

Anurag Chaurasia3535 14-Feb-2011

Base Class Initilization is a concept from which we can call


method,properties and indexers of the class.We can also call the parent


class methos and also initilize the value in the parameter of parent class


construtor....

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

 


Updated 18-Sep-2014

Leave Comment

Comments

Liked By