Quantcast
Channel: Cadence Community
Viewing all articles
Browse latest Browse all 3331

SKILL++ class slots

$
0
0

I have a few question on slots in a class. Given the following class that implements string utilities:

defclass( String()

 ()

(

(str @initarg nil) ; The string

(len @initarg nil); The length of the string 

)

)

defmethod( Length ((s String))

s->len = strlen(str)

 

Is there a way to trigger Length() whenever the slot "str" is updated? I know I could make another method like "SetStr" but that is a little messy, I also have to remember to always use that method and not set str directly.

Thank you,

Aaron 


Viewing all articles
Browse latest Browse all 3331

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>