Friday, June 29, 2018

Classes

A class is constructed of member which can be variables or methods.Variables are used to store the data for the class. They are specific to
an object; every object instantiated from the class declaration has its
own copy of the variable. Such variables are known as instance
variables.
Methods are the functions that operate on the data and define the
object's behavior. They are often declared to operate on the instance
variables of the class, and are known as instance methods.
A class is not an object. A class is an outline that defines how an object behaves
when the object is created from the class. Obtain concrete objects by instantiating
a previously defined class. Many objects can be instantiated from one class
definition.
Declaration of ClassesA class contains the properties, methods, and variables needed by the object.
Create a class by right-clicking the Classes node of the AOT and selecting New
Class, or by using the Class Wizard at
Tools > Development Tools > Wizards.A class always contains a classDeclaration node and two methods:ClassDeclaration: Specifies the name of the class and necessary
variables. It can also specify inheritance.
NOTE: classDeclaration is not a method. It is a class-level scope area used to
define variables that are global to all non-static methods within the class. This
means that you can use these variables in any methods in the class, and the
variable value will be the same in each method.
New(): This method instantiates a new object. You can also assign
values to object variables using this method.
Finalize(): This method terminates the object. It is never used within
the application and exists only for convention.
These methods enable the object instantiation to occur. An infinite number of
methods can be added to a class.

Demonstration: Create a Class in the Application Object
Tree
This demonstration illustrates how to create classes, add variables to the class,
and create a method in a class. Perform the following steps to create a class in the
AOT:
1. Open the
AOT.
2. Locate the
Classes node.
3. Right-click the
Classes node and select New Class in the context
menu. A new class named
Class1 is created and contains one node:
the
classDeclaration node. It is empty by default. The following
figure shows how the new class looks.


Demonstration: Create Variables in the ClassPerform the following steps to create variables in the class:
1. Double
-click the classDeclaration node.
2. Enter the declarations between the two { } braces.
Demonstration: Create New Methods in a ClassPerform the following steps to create new methods in a class:
1. Right
-click the class and select New Method.
2. Rename the method.
3. Type code between the two { } braces.


Best Regards,
Hossein Karimi

No comments:

Post a Comment

Configure the Firewall on the Enterprise Portal Server

After you install Enterprise Portal, enable Web Server (HTTP) in Windows Firewall. If you do not enable the web server in Windows Firewall...