Friday, March 26, 2010

Constructors In C#

This is a good example on Constructor calling in C# with  Reference to Abstract Class

and here is the sample code

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


namespace CheckAbstract
{
abstract class AbstractTest
{

public AbstractTest(int i)
{
Console.WriteLine("In Abstract" + i.ToString());

}



private AbstractTest()
{
Console.WriteLine("In Abstract");

}
}

class myclass:AbstractTest
{
public myclass() : base(1)
{
Console.WriteLine("In MyClass");

}

}
}

No comments:

Recent Posts