Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2013-08-06
14:24 • Closed ticket [3611641fff]: superclass method does not get exportet plus 5 o... artifact: c7520f5511 user: dkf
2013-08-03
19:48 • Ticket [3611641fff]: 2 changes artifact: 1b5553e558 user: dkf
19:31 • Ticket [3611641fff]: 8 changes artifact: 2add6189f3 user: dkf
2013-04-23
16:31 • Ticket [3611641fff]: 4 changes artifact: 88e2dd5fea user: tombert
09:30 • New ticket [3611641fff]. artifact: 2b83f6b21c user: tombert

superclass method does not get exportet

Closed / Works For Me3611641fffffffffffffffffffffffffffffffffCreated 14 years agoUpdated 13 years ago
Descriptionplain2013-04-23 09:30:31
Considering this example here: 
<pre>
oo::class create B { 
   variable bvar 
   constructor args {set bvar "fromB"} 
   method getBvar args {return $bvar} 
} 

oo::class create A { 
   superclass B 
   variable avar 
   constructor args {set avar "fromA"} 
   method getAvar args {return $avar} 
} 
</pre>
Without putting the "next" statement into the constructor of A it is impossible to call methods from class B: 
<pre>
> set a [A new] 
::oo::Obj92 
> $a getAvar 
fromA 
> $a getBvar 
invalid command name "getBvar" 
</pre>
tombertplain2013-04-23 16:31:24
https://groups.google.com/forum/?fromgroups=#!topic/comp.lang.tcl/8owilCo8LcA
dkfhtml2013-08-03 19:31:04

Can't reproduce:

% set a [A new]
::oo::Obj13
% $a getAvar
fromA
% $a getBvar
can't read "bvar": no such variable
can't read "bvar": no such variable
    while executing
"return $bvar"
    (class "::B" method "getBvar" line 1)
    invoked from within
"$a getBvar"

dkf Ticket [3611641fff]: 2 changes [History diff]2013-08-03 19:48:02
dkfwiki2013-08-06 14:24:32

Whatever is going on, it Works For Me. Yes, there's an error but that's just a “variable not set” problem which is trivial.

Log in (anonymous is fine) to add a comment.