An object type is a description or definition of some entity. This definition of an object type is characterized by two components:
• Attributes – fields that describe particular characteristics of an object instance. For a person object, examples might be name, address, gender, date of birth, height, weight, eye color, occupation, etc.
• Methods – programs that perform some type of function or operation on, or related to an object. For a person object, examples might be calculating the person’s age, displaying the person’s attributes, changing the values assigned to the person’s attributes, etc.6.1.1 AttributesEvery object type must contain at least one attribute. The data type of an attribute can be any of the following:
• A base data type such as NUMBER, VARCHAR2, etc.
• A globally defined collection type (created by the CREATE TYPE command) such as a nested table or varrayAn attribute gets its initial value (which may be null) when an object instance is initially created. Each object instance has its own set of attribute values.6.1.2 MethodsMethods are SPL procedures or functions defined within an object type. Methods can be categorized into three general types:
• Member Methods – procedures or functions that operate within the context of an object instance. Member methods have access to, and can change the attributes of the object instance on which they are operating.
• Static Methods – procedures or functions that operate independently of any particular object instance. Static methods do not have access to, and cannot change the attributes of an object instance.
• Constructor Methods – functions used to create an instance of an object type. A default constructor method is always provided when an object type is defined.6.1.3 Overloading MethodsIn an object type it is permissible to define two or more identically named methods of the same type (this is, either a procedure or function), but with different signatures. Such methods are referred to as overloaded methods.