Menu

#281 Protected common variables not visible to children

4.0*
closed-fixed
None
5
2018-02-15
2018-02-13
No

The following script correctly prints 1 in Itcl 3.4, but erroneously prints 0 in Itcl 4.1.1:

package require Itcl

itcl::class Parent {
    protected common x 0
}

itcl::class Child {
    inherit Parent
    #private common y 0 ;# <---- uncomment to make work
    puts [info exists Parent::x]
}

Uncommenting the indicated line makes the script work as expected.

Discussion

  • Don Porter

    Don Porter - 2018-02-15
    • status: open --> closed-fixed
    • assigned_to: Don Porter
     
  • Don Porter

    Don Porter - 2018-02-15

    Fixed for Itcl 4.1.2

     

Log in to post a comment.