Run Code  | API  | Code Wall  | Misc  | Feedback  | Login  | Theme  | Privacy  | Patreon 

Inheritance Ctor

//Rextester.Program.Main is the entry point for your code. Don't change it.
//Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5

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

namespace Rextester
{
    public class GrandParent
    {
        public GrandParent()
        {
            Console.WriteLine("Grand Parent default ctor");
        }
    }
    public class Parent : GrandParent
    {
        public Parent()
        {
            Console.WriteLine("Parent class default ctor");
        }
        public Parent(string param)
        {
            Console.WriteLine("Parent class parametric ctor");
        }
    }
    
    public class Child :Parent
    {
        public Child ():base("Child1")
        {
            Console.WriteLine("Child class default ctor");
        }
    }
    
    public class Program
    {
        public static void Main(string[] args)
        {
            //Your code goes here
            //Console.WriteLine("Hello, world!");
            Child childObj = new Child();
            
            
        }
    }
}
 run  | edit  | history  | help 0