Ver código fonte

Add test "casting descendants"

Ronny Otto 11 anos atrás
pai
commit
74adcca698

+ 25 - 0
tests/framework/types/hierarchy_03.bmx

@@ -0,0 +1,25 @@
+SuperStrict
+
+'needed to get it compile
+Framework BRL.StandardIO
+
+Type GrandParent
+	Field prop:String = "A"
+End Type
+
+
+Type Parent Extends GrandParent
+	Field prop:String = "B"
+End Type
+
+
+Type Myself Extends Parent
+	Field prop:String = "C"
+End Type
+
+
+Local B:Parent = new Parent
+
+If GrandParent(B) then  print "Parent can cast to GrandParent"
+If Parent(B) then print "Parent can cast to self"
+If Myself(B) then print "Parent can cast to child - FORBIDDEN!"

+ 2 - 0
tests/framework/types/hierarchy_03.res

@@ -0,0 +1,2 @@
+Parent can cast to GrandParent
+Parent can cast to self