Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.2.1 | 

Adding a Superclass

Description

To extend class inheritance, add a superclass to a class. A relationship between two classes is created when a superclass is added to an existing class. Adding a superclass does not mean adding a new class.

Syntax

ALTER [ class_type ] class_name
ADD SUPERCLASS [ user_name.]class_name [ { , [ user_name.]class_name }_ ]
[ INHERIT resolution [ {, resolution }_ ] ] [ ; ]

resolution:
[ CLASS ] attr_mthd_name OF superclass_name [ AS alias ]

For the first class_name, specify the name of the class where a superclass is to be added. Attributes and methods of the superclass can be inherited by using the syntax above.

Name conflicts can occur when adding a new superclass. If a name conflict cannot be resolved by the database system, attributes or methods to inherit from the superclass can be specified by using the INHERIT clause. You can use aliases to inherit all attributes or methods that cause the conflict. For more information on superclass name conflicts, see the Resolving Class Conflict section.

Example

The following is an example of creating the female_event class by inheriting the event class included in demodb.

CREATE CLASS female_event UNDER event;