PDA

View Full Version : Parameter/property inheritance



pacman
03-29-2009, 12:47 PM
If I had an object {lets call it Fred} that is of type BigObject, but BigObject uses another object {FullDuplexSerial} how can I make the Start/stop/etc parameters of FullDuplexSerial inherited by bigObject?

Rather than have my own 'start' procedure in BigObject (that just calls the start parameter of FullDuplexSerial and directly passes the inputs), I could then just call "Fred.Start (12,13,0,9600)" for example.


Thanks in advance

Paul

Mike Green
03-29-2009, 01:09 PM
You can't. Spin is not a complete object oriented language. In fact, its object orientation is quite limited. Only method names and named constants are inherited and inheritance only goes out one level.

Phil Pilgrim (PhiPi)
03-29-2009, 01:10 PM
Inheritance as you describe it is not implemented in Spin. Your object's start method will have to call the one in FullDuplexSerial explicitly.

-Phil