First of all I want to say sorry to all bcoz I m writting this blog after a long time.
Today I want write how to create object(instance) in programming language.
In last post i have written what is object?
For creating object we have to write following line of code
classname objectname=new classname();
After writting this code we can call method or access variable of that class
here classname refers name of class .
and object name refers name of object.
new is a key word that allocates memory for the object.
to clear understand see following code below.
class ABC
{
public static void Main()
{
ABC obj=new ABC(); //here obj is actual object.
}
}
To call a method in C# and how to access variable in C# we will learn next day.
About Me
Thursday, November 25, 2010
Subscribe to:
Posts (Atom)