\b;Инструкция \c;class\n;
This keyword allows you to create a class definition by using the following syntax:
\c;
\s;public class ClassName
\s;{
\s;	declarations;
\s;}
\n;
\t;All Classes Are Public
Классы могут быть \l;public\u cbot\public;. Это означает что они могут использоваться всеми ботами миссии.

\b;Class Members
Class members are fields (\l;variables\u cbot\var;) and methods (\l;functions\u cbot\function;).

For example, the following class dubbed \c;MyClass\n; contains 4 fields (\c;a\n;, \c;b\n;, \c;x\n; and \c;s\n;) and one method (\c;MyFunction\n;).
\c;
\s;public class MyClass
\s;{
\s;	int     a, b;
\s;	float   x = 3.33;
\s;	string  s = "hello";
\s;	float   MyFunction(float value)
\s;	{
\s;		return (value * x) - 1;
\s;	}
\s;}
\n;
\b;Accessing Class Members
Class members can be accessed outside of the class definition by using the \c;.\n; operator. Example:
\c;
\s;public class MyClass
\s;{
\s;	int myField = 0;
\s;	int MyFunction()
\s;	{
\s;		return myField * 2;
\s;	}
\s;}
\s;
\s;extern void object::Test()
\s;{
\s;	MyClass myObject();
\s;	myObject.myField = 10;
\s;	message(myObject.MyFunction()); // 20
\s;	MyClass mySecondObject();
\s;	mySecondObject.myField = myObject.myField - 2;
\s;	message(mySecondObject.MyFunction()); // 16
\s;}
\n;
Class members are \l;public\u cbot\public; by default, which means that they are accessible outside of the class definition. They can also be declared as \c;\l;private\u cbot\private;\n; or \c;\l;protected\u cbot\protected;\n;. Such members can only be accessed inside of the class definition.

\t;Class Members Modifiers
Fields and methods can also be declared as \c;\l;static\u cbot\static;\n;. Methods can be additionaly declared as \c;\l;synchronized\u cbot\synchro;\n;.

\t;Member Initialization
Как показано в предыдущем примере, члены класса могут быть инициализированы в определении класса (\c;int x = 3.33;\n;).

Another way of initiliazing fields is by defining a constructor which is a special method having the same name as the class. This method will be called automatically at \l;creation\u cbot\new; time of a class instance. Constructors can be \l;overloaded\u cbot\function;.

Example:\c;
\s;public class MyClass
\s;{
\s;	int  a, b;
\s;	void MyClass()
\s;	{
\s;		a = 2;  b = 3;
\s;	}
\s;	void MyClass(int a, int b)
\s;	{
\s;		this.a = a;  this.b = b;
\s;	}
\s;}
\n;

\t;Using \c;\l;this\u cbot\this;\n;
As the names of the parameters of the second constructor are the same as the names of the two members \c;a\n; and \c;b\n;, we must use the \c;\l;this\u cbot\this;\n; \l;reference\u cbot\pointer; to avoid confusion with the parameters' names.

\b;Создание Объекта
Мы можете создавать объекты типа \c;YourClass\n; используя ключевое слово \c;\l;new\u cbot\new;\n;. Например:
\c;
\s;extern void object::Test()
\s;{
\s;	MyClass object1();       // Вызовет конструктор по умолчанию (тот, который без входных параметров)
\s;	MyClass object2(4, 5);   // Вызовет конструктор с двумя двумя параметрами
\s;	MyClass object3;         // Не вызовет конструктор, а просто объявит пустой объект, object3 == null
\s;	object3 = new MyClass(); // А вот теперь конструктор вызван, object3 != null
\s;}
\n;

\b;Object Destruction
You can also define a destructor. This must be a \c;\l;void\u cbot\void;\n; fonction without parameters, which has the same name as the class but prefixed with the \c;~\n; character. The destructor is called automatically as soon as the class instance is no more referenced by anyone. Example:
\c;
\s;public class MyClass
\s;{
\s;	static private int counter = 0; // instance counter
\s;	void  MyClass( )
\s;	{
\s;		counter++;  // one instance more
\s;	}
\s;	void ~MyClass( )
\s;	{
\s;		counter--;  // one instance less
\s;	}
\s;}
\s;extern void object::Test()
\s;{
\s;	                   // counter == 0
\s;	MyClass item1( );  // counter == 1
\s;	MyClass item2( );  // counter == 2
\s;	item1 = null;      // counter == 1
\s;}
\s;// counter == 0
\n;
\b;Передача Объектов Функциям
Objects in CBOT are passed by \l;reference\u cbot\pointer;. This means that when an object is passed to a \l;function\u cbot\function;, the function receives a copy of a pointer to the instance, not a copy of the object, so any modifications on the object will be visible outside of the function.

\b;Наследование
A class can inherit public and protected members of another class by using the \c;\l;extends\u cbot\extends;\n; keyword.

\t;См. также
\c;\l;public\u cbot\public;\n;, \c;\l;private\u cbot\private;\n;, \c;\l;protected\u cbot\protected;\n;, \c;\l;static\u cbot\static;\n;, \c;\l;synchronized\u cbot\synchro;\n;, \c;\l;new\u cbot\new;\n;, \c;\l;reference\u cbot\pointer;\n;, \c;\l;this\u cbot\this;\n;, \c;\l;super\u cbot\super;\n;, \c;\l;extends\u cbot\extends;\n;
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.
