module my
type AType<S> {
memref : Ref<S>; ## default is private
public self( s : Ref<S> ) { ## constructor
self.memref = s;
}
public getter()->Ref<S> { ## Ref<S> can also be written &S
return self.memref;
}
}
main()->Int {
obj := new AType<Int>( 42 );
ret := obj.getter();
return ret;
}
No comments:
Post a Comment