Posted to tcl by dgp at Thu Jul 13 20:00:14 GMT 2017view raw

  1. % itcl::class B {
  2. variable b
  3. constructor {} {set b 2}
  4. }
  5. % itcl::class D {
  6. inherit B
  7. method foo {} {puts "b is $b ([namespace which -variable b] in [namespace current])"}
  8. }
  9. % D d
  10. d
  11. % d foo
  12. b is 2 (::itcl::internal::variables::oo::Obj15::B::b in ::D)
  13.