Process-oriented Program The main difference between design and object-oriented programming is the appearance of classes. A class is just a module that contains both public and private methods and data. A class is unique. A class can have multiple instances, and each instance contains different data. These instances are usually called objects. We will see examples of a single instance and multiple instances later.
Constructor:All classes have special constructors that are called when a class instance is created. The constructor name is always the same as the class name. For example:
Public class form1
{
Public form1 () // Constructor
{
Initializecomponent ();
}
}
if you need to add other initialization Code for the class, you usually compile a private init method and call it after the initializecomponent method.
public class form1
{< br> Public form1 () // constructor
{< br> initializecomponent ();
Init ();
}< br> private void Init ()
{< br> X = 12.5f; // set initial value of X
}< BR >}