Posted to tcl by aspect at Mon Jun 01 15:53:26 GMT 2015view raw
- package require TclOO
- oo::class create small_class {
- constructor {} {}
- method hello {} {puts hello}
- }
- oo::class create large_class {
- constructor {} {
- small_class create myFirstSmallObject
- small_class create mySecondSmallObject
- oo::objdefine [self] forward second mySecondSmallObject
- }
- forward first myFirstSmallObject
- method hello {} {
- myFirstSmallObject hello
- mySecondSmallObject hello
- }
- }
- large_class create myLargeObject
- myLargeObject hello
- myLargeObject first hello
- myLargeObject second hello