Unit 5 - ODMG Object Model
Unit 5 - ODMG Object Model
interface Date:Object {
enum weekday{sun,mon,tue,wed,thu,fri,sat};
enum Month{jan,feb,mar,…,dec};
unsigned short year();
unsigned short month();
unsigned short day();
…
boolean is_equal(in Date other_date);
};
ODMG Class
• A class is a specification of abstract behavior
and state of an object type
– A class is Instantiable
– Supports “extends” inheritance to allow both
state and behavior inheritance among classes
– Multiple inheritance via “extends” is not allowed
ODL Examples (1)
A Very Simple Class
• A very simple, straightforward class definition
– (all examples are based on the university schema
presented in Chapter 4):
class Degree {
attribute string college;
attribute string degree;
attribute string year;
};
ODL Examples (2)
A Class With Relationships
• Note extends (inheritance) relationship
• Also note “inverse” relationship