I have a e.g. class TestClass with several properties and constructors. The class has for example the property BackgroundColor As Color.
If I now have another class MyClass which have a property Fill As TestClass, is it possible and if so, how, to use MyClass.Fill = Color.Red which then automatically creates an instance of TestClass and sets the BackgroundColor to Color.Red?
EDIT: I’ve created a small sample Project. Had no luck until now. Where am I wrong? I think it is about the fact that I will use several subclasses and the right one has to be assigned.
Thanks Tim. You’re right. What I want is something like that:
I have a base class called Shading. There are Subclasses of Shading: ColorShading (with BackgroundColor As Color Property) & PictureShading (with BackgroundPicture As Picture Property). Now I simply want to do something like this for Shading instances:
Var shad As Shading ' Base Class.
shad = Color.Red ' Should return a ColorShading (Subclass of Shading) Instance.
shad = MyPicture ' Should return a PictureShading (Subclass of Shading) Instance.