[Xotcl] Can't call protected class method from instances

Arthur Schreiber schreiber.arthur at googlemail.com
Fri Feb 10 11:45:08 CET 2012


Hello Gustaf,

Is not being able to call protected class methods from instances intended
behaviour?

Here is a very simple test case:

package require nx

nx::Class create Greeter {
    :class protected method say_hi {} {
        puts "Hello!"
    }

    :public method say_hi {} {
        [:info class] say_hi
    }
}

[Greeter new] say_hi

Also, protected methods can not be called from instances of the same class,
e.g.:

package require nx

nx::Class create Greeter {
    :public method say_hi { other_greeter } {
        $other_greeter protected_say_hi
    }

    :protected method protected_say_hi { } {
        puts "Hello!"
    }
}

set g1 [Greeter new]

[Greeter new] say_hi $g1

Kind Regards,
Arthur


More information about the Xotcl mailing list