Object Creation
In this lesson, we will create a rectangle object and study its properties.
We'll cover the following...
The Structure
The structure of an object is very similar to that of a record. A typical object contains three components:
Values
These are the properties of the object. They are defined in the object body using the val
keyword. The values of an object cannot be directly accessed from the outside.
Depending on our program, the values of an object can be mutable or immutable.
Public Functions
Public functions are methods which can manipulate and use the object’s values. They can be defined using the ...