Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
23
Task/Inheritance-Multiple/Phix/inheritance-multiple-2.phix
Normal file
23
Task/Inheritance-Multiple/Phix/inheritance-multiple-2.phix
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
class Camera
|
||||
public string name = "nikkon"
|
||||
end class
|
||||
class MobilePhone
|
||||
public string name = "nokia" -- (clash no more)
|
||||
end class
|
||||
class CameraPhone
|
||||
-- Camera c = new()
|
||||
-- MobilePhone m = new()
|
||||
public Camera c
|
||||
public MobilePhone m
|
||||
procedure show() ?{c.name,m.name} end procedure
|
||||
end class
|
||||
Camera c = new({"canon"})
|
||||
MobilePhone m = new()
|
||||
CameraPhone cp1 = new({c,m}),
|
||||
cp2 = new({new("Camera"),new("MobilePhone")}),
|
||||
cp3 = new() -- (internal/shared/NULL c,m)
|
||||
cp3.c = new() -- (obviously c must be public)
|
||||
cp3.m = new({"LG20"}) -- "" m "" ""
|
||||
cp1.show()
|
||||
cp2.show()
|
||||
cp3.show() -- crashes without internal/above new()
|
||||
Loading…
Add table
Add a link
Reference in a new issue