A class or struct definition is like a blueprint that specifies what the
type can do. An object is basically a block of memory that has been
allocated and configured according to the blueprint. A program may
create many objects of the same class. Objects are also called
instances, and they can be stored in either a named variable or in an
array or collection.In
an object-oriented language such as C#, a typical program consists of
multiple objects interacting dynamically.
example:
{
A a=new A(); // object
int x=a.m(20,10);
}
}
public class A // class
{
public int m(int x,int y); // method( x & y are parameter)
{
int z=x+y;
return z;
}
}
}
No comments:
Post a Comment