2 ms·
> If base classes were only allowed to be used in inheritance and couldn't be parameters, generics, etc then that would force users to create base classes and p
by dragonwriter 3y ago
> If base classes were only allowed to be used in inheritance and couldn't be parameters, generics, etc then that would force users to create base classes and public interfaces in pairs
Which, if its a common thing, suggests that there should be syntax for like:
interface IFoo from FooBase;
That makes an interface from the public members of a class.
Or, perhaps even better, type systems should enablr.a distinction between:
class ConcreteFoo inherits FooBase; // normal implementation inheritance
class ConcreteFoo implements FooBase;
// is required to (compiler checked) present the public interface of FooBase, and is type-compatible, but doesn't inherit implementation
So concrete classes can also serve as interfaces, and purely abstract classes are identical to interfaces.