Monday, 30 June 2014

Multi Level Inheritance

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

public class xyz                                             \\ First class
{
    public void demo()
    {
        System.Console.WriteLine("First class");
    }

}
public class abc : xyz                                       \\ second class which inherit the first class
{
    public void demo()
    {
        System.Console.WriteLine("Second class abc");
    }
}
        public class Program:abc                              \\ Main class
        {
        public static void Main(string []args)
        {
            System.Console.WriteLine("I m main class");
            abc k = new abc();                                   \\ creating object
            k.demo();
            xyz p = new xyz();
            p.demo();
        }
        }
     

No comments:

Post a Comment