Open GWRon opened 2 months ago
Is this "normal" behaviour?
Yes, because any type that contains an abstract method implicitly becomes an abstract type, and adding Abstract
to the type definition is optional in that case. TBase
is abstract because it inherits Draw
, which is why it complains if you try to create an instance of it.
What should however be an error is adding Final
to the class, because Abstract Final
types are not allowed.
When using an interface and not implementing the required method it compiles as long as no instance is created:
Remove the comment sign above and try to compile again ...
Is this "normal" behaviour? I would have expected the compiler blames it in both cases.
Now I tried to check if I can circumvent the limitation of the "Can't create instance of type TBase":
This compiles - which won't if the check was done regardless of how a TBase-instance is created.
Edit: But as @HurryStarfish pointed out at discord, Reflection.mod was always enabling the creation of "abstract" type instances (leading to exceptions when calling the errorneous methods then)