What is a Class?
A Class is a template or a blueprint for an object. An object exists only in memory at runtime; a class is a programming construct that we can work only directly during design time. Now for using object at runtime we need to define a class at design time. Objects are thus only created at runtime based on the template provided by class.
One’s class is defined; we can create numerous objects in memory.
Scope of Class members?
Within a Class block, members are declared as either Private or Public using the appropriate declaration statements. Anything declared as Private is visible only within the Class block. Anything declared as Public is visible within the Class block, as well as by code outside the Class block.
How to create class?
To create a class we use the Keyword “Class”, like we use Function or Sub to define functions or Subroutine.
‘Code for class
Class: – Keyword used to define the class
UFTHelp: – User defined name of the class
What is a property?
When an object is created from class, then we use properties to access and store data from the object.
Types of property?
1. Property Let:-It allows code outside of a class to place a value in a property variable. Thus it is same like a “Sub” Procedure in that it does not return a value.
2.Property Get:-Is the inverse of a “Property Let” , thus it allows code outside of class to read value of property variable,thus it is same like a “Function” procedure in that it returns a value.
3. Property Set: – Is same to “Property Let”, but it is exclusively used to set values for an object-based properties. Point is that it is used to set values for an object (FilesystemObject), rather than a variable with a numeric, date.
Defining a Method?
It is same as defining a Function or Sub procedure
We cannot nest classes.
Test script can have multiple classes
Keywords cannot be used to define the name of the class
By default all members of class are Public
Property Let must accept at least one value.