Sync
This commit is contained in:
parent
6f050a029e
commit
776bba907c
3887 changed files with 59894 additions and 7280 deletions
39
Task/Inheritance-Single/COBOL/inheritance-single-1.cobol
Normal file
39
Task/Inheritance-Single/COBOL/inheritance-single-1.cobol
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
CLASS-ID. Animal.
|
||||
*> ...
|
||||
END CLASS Animal.
|
||||
|
||||
CLASS-ID. Dog INHERITS Animal.
|
||||
ENVIRONMENT DIVISION.
|
||||
CONFIGURATION SECTION.
|
||||
REPOSITORY.
|
||||
CLASS Animal.
|
||||
|
||||
*> ...
|
||||
END CLASS Dog.
|
||||
|
||||
CLASS-ID. Cat INHERITS Animal.
|
||||
ENVIRONMENT DIVISION.
|
||||
CONFIGURATION SECTION.
|
||||
REPOSITORY.
|
||||
CLASS Animal.
|
||||
|
||||
*> ...
|
||||
END CLASS Cat.
|
||||
|
||||
CLASS-ID. Lab INHERITS Dog.
|
||||
ENVIRONMENT DIVISION.
|
||||
CONFIGURATION SECTION.
|
||||
REPOSITORY.
|
||||
CLASS Dog.
|
||||
|
||||
*> ...
|
||||
END CLASS Lab.
|
||||
|
||||
CLASS-ID. Collie INHERITS Dog.
|
||||
ENVIRONMENT DIVISION.
|
||||
CONFIGURATION SECTION.
|
||||
REPOSITORY.
|
||||
CLASS Dog.
|
||||
|
||||
*> ...
|
||||
END CLASS Collie.
|
||||
5
Task/Inheritance-Single/COBOL/inheritance-single-2.cobol
Normal file
5
Task/Inheritance-Single/COBOL/inheritance-single-2.cobol
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
(defclass animal () ())
|
||||
(defclass dog (animal) ())
|
||||
(defclass lab (dog) ())
|
||||
(defclass collie (dog) ())
|
||||
(defclass cat (animal) ())
|
||||
5
Task/Inheritance-Single/COBOL/inheritance-single-3.cobol
Normal file
5
Task/Inheritance-Single/COBOL/inheritance-single-3.cobol
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/COBOL/inheritance-single-4.cobol
Normal file
9
Task/Inheritance-Single/COBOL/inheritance-single-4.cobol
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/COBOL/inheritance-single-5.cobol
Normal file
6
Task/Inheritance-Single/COBOL/inheritance-single-5.cobol
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;
|
||||
19
Task/Inheritance-Single/Nemerle/inheritance-single.nemerle
Normal file
19
Task/Inheritance-Single/Nemerle/inheritance-single.nemerle
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
class Animal {
|
||||
// ...
|
||||
}
|
||||
|
||||
class Dog: Animal {
|
||||
// ...
|
||||
}
|
||||
|
||||
class Lab: Dog {
|
||||
// ...
|
||||
}
|
||||
|
||||
class Collie: Dog {
|
||||
// ...
|
||||
}
|
||||
|
||||
class Cat: Animal {
|
||||
// ...
|
||||
}
|
||||
55
Task/Inheritance-Single/NetRexx/inheritance-single.netrexx
Normal file
55
Task/Inheritance-Single/NetRexx/inheritance-single.netrexx
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/* NetRexx */
|
||||
options replace format comments java crossref symbols binary
|
||||
|
||||
class RInheritSingle public
|
||||
method main(args = String[]) public static
|
||||
animals = [ -
|
||||
RInheritSingle_Animal(), -
|
||||
RInheritSingle_Cat(), -
|
||||
RInheritSingle_Dog(), -
|
||||
RInheritSingle_Lab(), -
|
||||
RInheritSingle_Collie() -
|
||||
]
|
||||
|
||||
say 'Object ID'.left(12) 'Class type'.left(24) 'Superclass type'
|
||||
say '.'.left(12, '.') '.'.left(24, '.') '.'.left(24, '.')
|
||||
loop animal over animals
|
||||
parse animal.whatAmI() oid ct st
|
||||
say oid.left(12) ct.left(24) st
|
||||
end animal
|
||||
return
|
||||
|
||||
class RInheritSingle_Animal private
|
||||
properties indirect
|
||||
whatThatIs = String
|
||||
whatThisIs = String
|
||||
method RInheritSingle_Animal() public
|
||||
-- Animal specific set-up
|
||||
setWhatThatIs(this.getClass().getSuperclass().getSimpleName())
|
||||
setWhatThisIs(this.getClass().getSimpleName())
|
||||
return
|
||||
method hashToString() public
|
||||
return '@'(Rexx this.hashCode()).d2x().right(8, 0)
|
||||
method whatAmI() public
|
||||
iAmText = hashToString() getWhatThisIs() getWhatThatIs()
|
||||
return iAmText
|
||||
|
||||
class RInheritSingle_Cat private extends RInheritSingle_Animal
|
||||
method RInheritSingle_Cat() public
|
||||
-- Do Cat specific set-up
|
||||
return
|
||||
|
||||
class RInheritSingle_Dog private extends RInheritSingle_Animal
|
||||
method RInheritSingle_Dog() public
|
||||
-- Do Dog specific set-up
|
||||
return
|
||||
|
||||
class RInheritSingle_Lab private extends RInheritSingle_Dog
|
||||
method RInheritSingle_Lab() public
|
||||
-- Do Lab specific set-up
|
||||
return
|
||||
|
||||
class RInheritSingle_Collie private extends RInheritSingle_Dog
|
||||
method RInheritSingle_Collie() public
|
||||
-- Do Collie specific set-up
|
||||
return
|
||||
|
|
@ -7,7 +7,7 @@ Object subclass: #Animal
|
|||
"* declare methods here, separated with '!' *"
|
||||
"* !Animal methodsFor: 'a category'! *"
|
||||
"* methodName *"
|
||||
"* method body! !
|
||||
"* method body! !"
|
||||
|
||||
!Animal subclass: #Dog
|
||||
"* etc. *" !
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue