User classes

Info about design forms features
PetrS
Site Admin
Posts: 181
Joined: 11 Jul 2014, 13:55

User classes

Postby PetrS » 16 Jul 2014, 06:42

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.
Attachments
Class.cls
(40.98 KiB) Downloaded 406 times
Ing. Petr Slepicka
DesignForms Online
Engineering calculations online - EuroCode, AISC, statics
Automate your static calculations today!

PetrS
Site Admin
Posts: 181
Joined: 11 Jul 2014, 13:55

Re: User classes

Postby PetrS » 08 Dec 2014, 10:53

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.
Attachments
Class constructors.cls
(23.32 KiB) Downloaded 390 times
Ing. Petr Slepicka
DesignForms Online
Engineering calculations online - EuroCode, AISC, statics
Automate your static calculations today!


Return to “Design forms features”

Who is online

Users browsing this forum: No registered users and 5 guests