Posted to tcl by aspect at Mon Jun 01 15:53:26 GMT 2015view raw

  1. package require TclOO
  2.  
  3. oo::class create small_class {
  4. constructor {} {}
  5. method hello {} {puts hello}
  6. }
  7.  
  8. oo::class create large_class {
  9. constructor {} {
  10. small_class create myFirstSmallObject
  11. small_class create mySecondSmallObject
  12. oo::objdefine [self] forward second mySecondSmallObject
  13. }
  14.  
  15. forward first myFirstSmallObject
  16.  
  17. method hello {} {
  18. myFirstSmallObject hello
  19. mySecondSmallObject hello
  20. }
  21. }
  22.  
  23. large_class create myLargeObject
  24. myLargeObject hello
  25. myLargeObject first hello
  26. myLargeObject second hello
  27.