home *** CD-ROM | disk | FTP | other *** search
- /*
- demo of a private method for a class
- private methods are only callable from within a method for a class
- */
- inherit(Nil,Temp,[]);
-
- private Temp::testPrivate(self)
- {
- ? "within testPrivate";
- }
-
- method Temp::test(self)
- {
- ? "enter Temp::test";
- testPrivate(self);
- ? "exit Temp::test";
- }
-
- v = new(Temp);
- test(v); % this will work, Temp::testPrivate will be called by Temp::test
- ? "the next statement will cause an error !...\n";
- testPrivate(v); % this will cause an error !
-