.net - Inherit and add properties to child class -
i can inherit class, , add properties new class... good.
class class1 property string end class class class2 inherits class1 property b string end class dim mytest new class2 mytest.a = "bleh" mytest.b = "bah"
how add properties child class inside class inheriting?
class class3 property string class class3_1 property c string end class end class
how create new class enherits class3, add property class3_1, inside new enherited class?
new edit actual non working code
public class testclass public class class1 property x string property firstchildclass new class1_1 public class class1_1 property string end class end class public class inherited_class1 inherits class1 public class class1_1 '///// warning here use "shadows" keyword.. not work... takes away warning, still cant access property b when using new instance of class property b string end class end class sub test() dim mytestclass new inherited_class1 mytestclass.firstchildclass.b = "blah" '///// not work... end sub end class
just include containing class in inheritance of sub class. have separately inherit containing class , sub class:
public class inherited_class1 inherits class1 public class class1_2 inherits class1_1 public property b() string end class end class public sub test() dim mytestclass new inherited_class1() dim ic new inherited_class1.class1_2() mytestclass.firstchildclass = ic ic.b = "blah" '''//// not work... end sub
Comments
Post a Comment