Page 1 of 1

User classes

Posted: 16 Jul 2014, 06:42
by PetrS
User classes

User class is object consisting of properties and methods.

In OOP, you use objects=classes in your programs to encapsulate the data associated with the entities with which the program is working. For example, a human resources application needs to work with employees. Employees have attributes associated with them that need to be tracked - names, addresses, departments, and so on. Although you track the same attributes for all employees, each employee has unique values for these attributes.

Along with the properties you also need an established set of behaviours exposed by object (class). For example, one employee behaviour of interest to the human resources department is the ability to request time off. The Employee object contains a RequestTimeOff method that encapsulates the necessary code.

A class enables you to create your own custom types by grouping together variables of various types and methods. A class is like a blueprint. It defines the data and behavior of a type. You can use it by creating instance which are assigned to a object variable.

UserClass declaration:
class <Class_Name> {
<Class_Properties>
<Class_Methods>
}

Initialise:
object <Varianble_Name> = new <Class_Name>();

Use:
User class can be used to encapsulated logic block of properties (values) and functions.
You can create multiple instances of one class type to make script clear, readable and more efficient.

See also:
url=http://msdn.microsoft.com/en-us/library/vstudio/x9afc042.aspxMSDN online help/url.

Re: User classes

Posted: 08 Dec 2014, 10:53
by PetrS
0Field value initializing, constructors
Version 0.1.103+

Since version 0.1.103+ you are able to define:
  • Initial value of class properties (fields)
  • Class constructors

:arrow: Class properties are initialised BEFORE the constructor is called => You can use class properties in class constructor.
:arrow: Default constructor (without parameters) is generated automatically. You don't have to define it manually.

See attached example for more details.