Displaying 1 result from an estimated 1 matches for "mysuperclass".
Did you mean:
issuperclass
2009 Nov 23
1
OOP with Encapsulated Class Definitions
...object~double ()
> myobject$x
[1] 20
Here class definitions are functions, however there are other possibilities...
Priority has been given to space rather than speed, hence the
unorthodox method despatch, however again, there are other
possibilities...
Here is an example of inheritance:
> MySuperClass = function (...)
{ MySuperClass = function (x) .$x = x
mymethod = function () cat (.$x, "\n")
mclass ()
}
> MySubClass = function (...)
{ MySubClass = function (y) super (y)
mclass (super="MySuperClass")
}
> myobj = MySubClass (10)
> myobj~mymethod ()...