YAPC::EU 2018 Glasgow Update!
This commit is contained in:
parent
22f33d4004
commit
4e2d22a71d
1170 changed files with 15042 additions and 3047 deletions
34
Task/Inheritance-Multiple/Ring/inheritance-multiple.ring
Normal file
34
Task/Inheritance-Multiple/Ring/inheritance-multiple.ring
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
# Project : Inheritance/Multiple
|
||||
|
||||
mergemethods(:CameraPhone,:MobilePhone)
|
||||
|
||||
o1 = new CameraPhone
|
||||
? o1
|
||||
? o1.testCamera()
|
||||
? o1.testMobilePhone()
|
||||
|
||||
func AddParentClassAttributes oObject,cClass
|
||||
# Add Attributes
|
||||
cCode = "oTempObject = new " + cClass
|
||||
eval(cCode)
|
||||
for cAttribute in Attributes(oTempObject)
|
||||
AddAttribute(oObject,cAttribute)
|
||||
cCode = "oObject." + cAttribute + " = oTempObject." + cAttribute
|
||||
eval(cCode)
|
||||
next
|
||||
|
||||
|
||||
class Camera
|
||||
Name = "Camera"
|
||||
func testCamera
|
||||
? "Message from testCamera"
|
||||
|
||||
class MobilePhone
|
||||
Type = "Android"
|
||||
func testMobilePhone
|
||||
? "Message from MobilePhone"
|
||||
|
||||
class CameraPhone from Camera
|
||||
|
||||
# Add MobilePhone Attributes
|
||||
AddParentClassAttributes(self,:MobilePhone)
|
||||
Loading…
Add table
Add a link
Reference in a new issue