RosettaCodeData/Task/Inheritance-Single/NetRexx/inheritance-single.netrexx

56 lines
1.6 KiB
Plaintext

/* 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