Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,45 @@
|
|||
Module CheckIt {
|
||||
Class Camera {
|
||||
Private:
|
||||
cameratype$
|
||||
Class:
|
||||
module Camera (.cameratype$){
|
||||
}
|
||||
}
|
||||
\\ INHERITANCE AT CODE LEVEL
|
||||
Class MobilePhone {
|
||||
Private:
|
||||
model$
|
||||
Class:
|
||||
module MobilePhone (.model$) {
|
||||
}
|
||||
}
|
||||
Class CameraPhone as Camera as MobilePhone {
|
||||
Module CameraPhone ( .model$, .cameratype$) {
|
||||
}
|
||||
}
|
||||
CP1 =CameraPhone("X-15", "OBSCURE")
|
||||
Print CP1 is type CameraPhone = true
|
||||
Print CP1 is type Camera = true
|
||||
Print CP1 is type MobilePhone = true
|
||||
|
||||
\\ INHERITANCE AT OBJECT LEVEL
|
||||
CP2 = MobilePhone("X-9") with Camera("WIDE")
|
||||
\\ CP3 has no type
|
||||
Group CP3 {
|
||||
Module PrintAll {
|
||||
If this is type Camera and this is type MobilePhone then
|
||||
Print .model$, .cameratype$
|
||||
Else
|
||||
Print "Nothing to print"
|
||||
End if
|
||||
}
|
||||
}
|
||||
CP3.PrintAll ' Nothing to print
|
||||
\\ using pointers and prepate inheritance at object level
|
||||
CP->(CP1 with CP3)
|
||||
CP=>PrintAll
|
||||
CP->(CP2 with CP3)
|
||||
CP=>PrintAll
|
||||
}
|
||||
CheckIt
|
||||
Loading…
Add table
Add a link
Reference in a new issue