Class Template

Is it possible to create a class that CANNOT be directly instantiated?
I want to create a “template” class… then 3 or 4 classes that build up on that one… but not allow the template class to be accessed except as a super.

CLASS_T is based on a CANVAS with methods, properties etc… but should never be accessed directly (DIM T as NEW CLASS_T should be an error)
CLASS_A inherits from CLASS_T and adds more “stuff”… CLASS_A can be used
as do CLASS_B , CLASS_C etc. each one adds a differnt set of extension methods or properites to the base CLASS_T

Add a Constructor method to CLASS_T and make it either protected or private.

You will then need to add public constructors to CLASS_A / CLASS_B etc…

If the constructor of CLASS_T is protected then the classes which inherit from it can call Super.Constructor in their constructor. If you don’t need that you can make CLASS_T.Constructor private.

[quote=422186:@Dave S]Is it possible to create a class that CANNOT be directly instantiated?
I want to create a “template” class… then 3 or 4 classes that build up on that one… but not allow the template class to be accessed except as a super.

CLASS_T has controls, properties etc… but should never be accessed directly (DIM T as NEW CLASS_T should be an error)
CLASS_A inherits from CLASS_T and adds more “stuff”… CLASS_A can be used
as do CLASS_B , CLASS_C etc. each one adds a differnt set of extension methods or properites to the base CLASS_T[/quote]

Yes - just give the base class a private no param constructor.

But you can’t inherit UI (I noticed you mentioned the base class has controls).

Actually the “base class” is based on a canvas… so it is not a container with embedded controls :slight_smile: