Data update

This commit is contained in:
Ingy döt Net 2026-04-30 12:34:36 -04:00
parent 4bb20c9b71
commit cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions

View file

@ -0,0 +1,13 @@
package Inheritance is
type Animal is tagged private;
type Dog is new Animal with private;
type Cat is new Animal with private;
type Lab is new Dog with private;
type Collie is new Dog with private;
private
type Animal is tagged null record;
type Dog is new Animal with null record;
type Cat is new Animal with null record;
type Lab is new Dog with null record;
type Collie is new Dog with null record;
end Inheritance;

View file

@ -0,0 +1,48 @@
IDENTIFICATION DIVISION.
CLASS-ID. Animal.
*> ...
END CLASS Animal.
IDENTIFICATION DIVISION.
CLASS-ID. Dog
INHERITS FROM Animal.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
REPOSITORY.
CLASS Animal.
*> ...
END CLASS Dog.
IDENTIFICATION DIVISION.
CLASS-ID. Cat
INHERITS FROM Animal.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
REPOSITORY.
CLASS Animal.
*> ...
END CLASS Cat.
IDENTIFICATION DIVISION.
CLASS-ID. Lab
INHERITS FROM Dog.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
REPOSITORY.
CLASS Dog.
*> ...
END CLASS Lab.
IDENTIFICATION DIVISION.
CLASS-ID. Collie
INHERITS FROM Dog.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
REPOSITORY.
CLASS Dog.
*> ...
END CLASS Collie.

View file

@ -0,0 +1,15 @@
class Animal {
// ...
}
class Cat extends Animal {
// ...
}
class Dog extends Animal {
// ...
}
class Lab extends Dog {
// ...
}
class Collie extends Dog {
// ...
}

View file

@ -0,0 +1,14 @@
class Animal ()
end
class Dog : Animal ()
end
class Cat : Animal ()
end
class Lab : Dog ()
end
class Collie : Dog ()
end

View file

@ -0,0 +1,30 @@
class Animal end
class Dog extends Animal
function type() return "Dog" end
end
class Cat extends Animal
function type() return "Cat" end
end
class Labrador extends Dog
function type() return "Labrador" end
end
class Collie extends Dog
function type() return "Collie" end
end
local animals = {new Dog(), new Cat(), new Labrador(), new Collie()}
for animals as a do
print($"{a:type()} is an Animal = {a instanceof Animal}")
end
print()
for animals as a do
print($"{a:type()} is a Dog = {a instanceof Dog}")
end
print()
for animals as a do
print($"{a:type()} is a Cat = {a instanceof Cat}")
end

View file

@ -0,0 +1,5 @@
class Animal {}
class Dog : Animal {}
class Cat: Animal {}
class Lab : Dog {}
class Collie : Dog {}

View file

@ -0,0 +1,26 @@
Rebol [
Title: "Inheritance"
URL: http://rosettacode.org/wiki/Inheritance
]
; REBOL provides subclassing through its prototype mechanism:
Animal: make object! [
legs: 4
]
Dog: make Animal [
says: "Woof!"
]
Cat: make Animal [
says: "Meow..."
]
Lab: make Dog []
Collie: make Dog []
; Demonstrate inherited properties:
print ["Cat has" Cat/legs "legs."]
print ["Lab says:" Lab/says]