class CACOverLoading
{
int x;
public CACOverLoading()
{
Console.WriteLine("Default constructor");
x = 123;
}
public CACOverLoading(int x)
{
Console.WriteLine("Parameterized constructor");
Console.WriteLine(x);
this.x = 789;
}
public void display()
{
Console.WriteLine(x);
}
public static void Main()
{
CACOverLoading col = new CACOverLoading();
col.display();
CACOverLoading col1 = new CACOverLoading(456);
col1.display();
Console.ReadLine();
}
}
Blog that contains articles about new technologies related or not with programming. I will describe and solves some problems that I encounter in my career. ASP .NET, AJAX, Javascript, C++, C# and SQL are some of the subjects that will appear.
31 July 2011
Constructor OverLoading in Console apps
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment