Simple OOP Using PicoLisp
PicoLisp has a very simple though powerfull OOP system. It's far more easier than any other OO language and is efficient enough to cover any of your needs.
(class +Cat)
(dm T (Age Name Owner)
(=: age Age)
(=: name Name)
(=: owner Owner))
(dm setName> (Name) (=: name Name))
(dm setAge> (Age) (=: age Age))
(dm setOwner> (Owner) (=: owner Owner))
(dm getOwner> () (get This 'owner))
(dm getName> () (get This 'name))
(dm getAge> () (get This 'age))
(dm getAddress> () (get This 'address))
(dm getPhone> () (get This 'phone))
(setq *Kelly (new '(+Cat) 2 'Kelly 'Kate))
(show *Kelly)
(send 'getAddress> *Kelly)
Even inheritance is very easy to implement and use. The next example defines a class +Dog which inherits from the class +Cat all of its properties. The constructor calls +Cat 's constructor.
(class +Dog +Cat)
(dm T (Age Name Owner)
(super Age Name Owner))
(setq *Tommy (new '(+Dog) 2 'Tommy 'Tasos))
(show *Tommy)
As you can see no new method has been defined and we can use all the methods defined at the super class.
(send 'setAge> *Tommy 34) -> 34
(send 'getAge> *Tommy) -> 34