Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
3
Task/Inheritance-Single/ChucK/inheritance-single-1.chuck
Normal file
3
Task/Inheritance-Single/ChucK/inheritance-single-1.chuck
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
public class Drums{
|
||||
//functions go here...
|
||||
}
|
||||
3
Task/Inheritance-Single/ChucK/inheritance-single-2.chuck
Normal file
3
Task/Inheritance-Single/ChucK/inheritance-single-2.chuck
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
public class LatinKit extends Drums{
|
||||
//functions go here...
|
||||
}
|
||||
3
Task/Inheritance-Single/ChucK/inheritance-single-3.chuck
Normal file
3
Task/Inheritance-Single/ChucK/inheritance-single-3.chuck
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
public class ElectronicKit extends Drums{
|
||||
//functions go here...
|
||||
}
|
||||
3
Task/Inheritance-Single/ChucK/inheritance-single-4.chuck
Normal file
3
Task/Inheritance-Single/ChucK/inheritance-single-4.chuck
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
public class Congas extends LatinKit{
|
||||
//functions go here...
|
||||
}
|
||||
3
Task/Inheritance-Single/ChucK/inheritance-single-5.chuck
Normal file
3
Task/Inheritance-Single/ChucK/inheritance-single-5.chuck
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
public class TechnoDrums extends ElectronicKit{
|
||||
//functions go here...
|
||||
}
|
||||
5
Task/Inheritance-Single/Coco/inheritance-single-1.coco
Normal file
5
Task/Inheritance-Single/Coco/inheritance-single-1.coco
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
class Animal
|
||||
class Cat extends Animal
|
||||
class Dog extends Animal
|
||||
class Lab extends Dog
|
||||
class Collie extends Dog
|
||||
28
Task/Inheritance-Single/Coco/inheritance-single-2.coco
Normal file
28
Task/Inheritance-Single/Coco/inheritance-single-2.coco
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
class Animal
|
||||
|
||||
(@name) ->
|
||||
|
||||
move: (meters) ->
|
||||
alert @name + " moved #{meters}m."
|
||||
|
||||
class Snake extends Animal
|
||||
|
||||
-> super ...
|
||||
|
||||
move: ->
|
||||
alert 'Slithering...'
|
||||
super 5
|
||||
|
||||
class Horse extends Animal
|
||||
|
||||
-> super ...
|
||||
|
||||
move: ->
|
||||
alert 'Galloping...'
|
||||
super 45
|
||||
|
||||
sam = new Snake 'Sammy the Python'
|
||||
tom = new Horse 'Tommy the Palomino'
|
||||
|
||||
sam.move!
|
||||
tom.move!
|
||||
33
Task/Inheritance-Single/Comal/inheritance-single-1.comal
Normal file
33
Task/Inheritance-Single/Comal/inheritance-single-1.comal
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
STRUC Animal
|
||||
DIM Species$ OF 20
|
||||
ENDSTRUC Animal
|
||||
|
||||
STRUC Dog
|
||||
INHERIT Animal
|
||||
DIM Race$ OF 20
|
||||
FUNC New CONSTRUCTOR
|
||||
Species$="Dog"
|
||||
ENDFUNC New
|
||||
ENDSTRUC Dog
|
||||
|
||||
STRUC Cat
|
||||
INHERIT Animal
|
||||
DIM Race$ OF 20
|
||||
FUNC New CONSTRUCTOR
|
||||
Species$="Cat"
|
||||
ENDFUNC New
|
||||
ENDSTRUC Cat
|
||||
|
||||
STRUC Lab
|
||||
INHERIT Dog
|
||||
FUNC New CONSTRUCTOR
|
||||
Race$:="Lab"
|
||||
ENDFUNC New
|
||||
ENDSTRUC Lab
|
||||
|
||||
STRUC Collie
|
||||
INHERIT Dog
|
||||
FUNC New CONSTRUCTOR
|
||||
Race$:="Collie"
|
||||
ENDFUNC New
|
||||
ENDSTRUC Collie
|
||||
5
Task/Inheritance-Single/Comal/inheritance-single-2.comal
Normal file
5
Task/Inheritance-Single/Comal/inheritance-single-2.comal
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
(defclass animal () ())
|
||||
(defclass dog (animal) ())
|
||||
(defclass lab (dog) ())
|
||||
(defclass collie (dog) ())
|
||||
(defclass cat (animal) ())
|
||||
5
Task/Inheritance-Single/Comal/inheritance-single-3.comal
Normal file
5
Task/Inheritance-Single/Comal/inheritance-single-3.comal
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
(defstruct animal)
|
||||
(defstruct (dog (:include animal)))
|
||||
(defstruct (lab (:include dog)))
|
||||
(defstruct (collie (:include dog)))
|
||||
(defstruct (cat (:include animal)))
|
||||
9
Task/Inheritance-Single/Comal/inheritance-single-4.comal
Normal file
9
Task/Inheritance-Single/Comal/inheritance-single-4.comal
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
;;; ASN.1 serialization logic specialized for animal class
|
||||
(defmethod serialize-to-asn-1 ((a animal))
|
||||
#| ... |#
|
||||
)
|
||||
|
||||
;;; casually introduce the method over strings too; no relation to animal
|
||||
(defmethod serialize-to-asn-1 ((s string))
|
||||
#| ... #|
|
||||
)
|
||||
6
Task/Inheritance-Single/Comal/inheritance-single-5.comal
Normal file
6
Task/Inheritance-Single/Comal/inheritance-single-5.comal
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
TYPE
|
||||
Animal = ABSTRACT RECORD (* *) END;
|
||||
Cat = RECORD (Animal) (* *) END; (* final record (cannot be extended) - by default *)
|
||||
Dog = EXTENSIBLE RECORD (Animal) (* *) END; (* extensible record *)
|
||||
Lab = RECORD (Dog) (* *) END;
|
||||
Collie = RECORD (Dog) (* *) END;
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
' FB 1.05.0 Win64
|
||||
|
||||
Type Animal Extends Object ' to enable virtual methods etc. if needed
|
||||
' ...
|
||||
End Type
|
||||
|
||||
Type Dog Extends Animal
|
||||
' ...
|
||||
End Type
|
||||
|
||||
Type Cat Extends Animal
|
||||
' ...
|
||||
End Type
|
||||
|
||||
Type Lab Extends Dog
|
||||
' ...
|
||||
End Type
|
||||
|
||||
Type Collie Extends Dog
|
||||
' ...
|
||||
End Type
|
||||
24
Task/Inheritance-Single/Lasso/inheritance-single.lasso
Normal file
24
Task/Inheritance-Single/Lasso/inheritance-single.lasso
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
define animal => type {
|
||||
data public gender::string
|
||||
}
|
||||
|
||||
define dog => type {
|
||||
parent animal
|
||||
}
|
||||
|
||||
define cat => type {
|
||||
parent animal
|
||||
}
|
||||
|
||||
define collie => type {
|
||||
parent dog
|
||||
}
|
||||
|
||||
define lab => type {
|
||||
parent dog
|
||||
}
|
||||
|
||||
local(myanimal = lab)
|
||||
|
||||
#myanimal -> gender = 'Male'
|
||||
#myanimal -> gender
|
||||
2
Task/Inheritance-Single/Lingo/inheritance-single-1.lingo
Normal file
2
Task/Inheritance-Single/Lingo/inheritance-single-1.lingo
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
-- parent script "Animal"
|
||||
-- ...
|
||||
7
Task/Inheritance-Single/Lingo/inheritance-single-2.lingo
Normal file
7
Task/Inheritance-Single/Lingo/inheritance-single-2.lingo
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
-- parent script "Dog"
|
||||
property ancestor
|
||||
|
||||
on new (me)
|
||||
me.ancestor = script("Animal").new()
|
||||
return me
|
||||
end
|
||||
7
Task/Inheritance-Single/Lingo/inheritance-single-3.lingo
Normal file
7
Task/Inheritance-Single/Lingo/inheritance-single-3.lingo
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
-- parent script "Cat"
|
||||
property ancestor
|
||||
|
||||
on new (me)
|
||||
me.ancestor = script("Animal").new()
|
||||
return me
|
||||
end
|
||||
7
Task/Inheritance-Single/Lingo/inheritance-single-4.lingo
Normal file
7
Task/Inheritance-Single/Lingo/inheritance-single-4.lingo
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
-- parent script "Lab"
|
||||
property ancestor
|
||||
|
||||
on new (me)
|
||||
me.ancestor = script("Dog").new()
|
||||
return me
|
||||
end
|
||||
7
Task/Inheritance-Single/Lingo/inheritance-single-5.lingo
Normal file
7
Task/Inheritance-Single/Lingo/inheritance-single-5.lingo
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
-- parent script "Collie"
|
||||
property ancestor
|
||||
|
||||
on new (me)
|
||||
me.ancestor = script("Dog").new()
|
||||
return me
|
||||
end
|
||||
6
Task/Inheritance-Single/Nim/inheritance-single.nim
Normal file
6
Task/Inheritance-Single/Nim/inheritance-single.nim
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
type
|
||||
Animal = object of RootObj
|
||||
Dog = object of Animal
|
||||
Cat = object of Animal
|
||||
Lab = object of Dog
|
||||
Collie = object of Dog
|
||||
5
Task/Inheritance-Single/Oforth/inheritance-single.oforth
Normal file
5
Task/Inheritance-Single/Oforth/inheritance-single.oforth
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
Object Class new: Animal
|
||||
Animal Class new: Cat
|
||||
Animal Class new: Dog
|
||||
Dog Class new: Lab
|
||||
Dog Class new: Collie
|
||||
5
Task/Inheritance-Single/Ring/inheritance-single.ring
Normal file
5
Task/Inheritance-Single/Ring/inheritance-single.ring
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
Class Animal
|
||||
Class Dog from Animal
|
||||
Class Cat from Animal
|
||||
Class Lab from Dog
|
||||
Class Collie from Dog
|
||||
5
Task/Inheritance-Single/Sidef/inheritance-single.sidef
Normal file
5
Task/Inheritance-Single/Sidef/inheritance-single.sidef
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
class Animal {};
|
||||
class Dog << Animal {};
|
||||
class Cat << Animal {};
|
||||
class Lab << Dog {};
|
||||
class Collie << Dog {};
|
||||
19
Task/Inheritance-Single/Swift/inheritance-single.swift
Normal file
19
Task/Inheritance-Single/Swift/inheritance-single.swift
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
class Animal {
|
||||
// ...
|
||||
}
|
||||
|
||||
class Dog : Animal {
|
||||
// ...
|
||||
}
|
||||
|
||||
class Lab : Dog {
|
||||
// ...
|
||||
}
|
||||
|
||||
class Collie : Dog {
|
||||
// ...
|
||||
}
|
||||
|
||||
class Cat : Animal {
|
||||
// ...
|
||||
}
|
||||
13
Task/Inheritance-Single/XLISP/inheritance-single-1.xlisp
Normal file
13
Task/Inheritance-Single/XLISP/inheritance-single-1.xlisp
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
(define-class animal)
|
||||
|
||||
(define-class dog
|
||||
(super-class animal))
|
||||
|
||||
(define-class cat
|
||||
(super-class animal))
|
||||
|
||||
(define-class collie
|
||||
(super-class dog))
|
||||
|
||||
(define-class lab
|
||||
(super-class dog))
|
||||
21
Task/Inheritance-Single/XLISP/inheritance-single-2.xlisp
Normal file
21
Task/Inheritance-Single/XLISP/inheritance-single-2.xlisp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
[1] (cat 'superclass)
|
||||
|
||||
#<Class:ANIMAL #x57094c8>
|
||||
[2] (collie 'superclass)
|
||||
|
||||
#<Class:DOG #x57094c8>
|
||||
[3] (animal 'superclass)
|
||||
|
||||
#<Class:OBJECT #x57094c8>
|
||||
[4] (dog 'show)
|
||||
|
||||
Object is #<Class:DOG #x57094c8>, Class is #<Class:CLASS #x57094c8>
|
||||
Instance variables:
|
||||
NAME = DOG
|
||||
MESSAGES = ()
|
||||
IVARS = ()
|
||||
CVARS = #<Environment #x5879788>
|
||||
SUPERCLASS = #<Class:ANIMAL #x57094c8>
|
||||
IVARCNT = 0
|
||||
IVARTOTAL = 0
|
||||
#<Class:DOG #x57094c8>
|
||||
Loading…
Add table
Add a link
Reference in a new issue