Creating a Subclass
# Now, we create a subclass of ::demo::Person called ::demo::Employee # which has a few more attributes. Again, we define an XOTcl class # ::demo::Employee which creates the ACS Object Type, the ACS # attributes and the table, if necessary. >> ::xo::db::Class create ::demo::Employee -superclass ::demo::Person -table_name demo_employee -id_column employee_id -slots { ::xo::db::Attribute create salary -datatype integer ::xo::db::Attribute create dept_nr -datatype integer -default "0" } = ::demo::Employee # The XOTcl class definition created automatically the # following table for storing instances: CREATE TABLE demo_employee ( dept_nr integer DEFAULT '0' , salary integer , employee_id integer REFERENCES demo_person(person_id) ON DELETE CASCADE CONSTRAINT demo_employee_employee_id_pk PRIMARY KEY )