4 ms·
> Note that instead of using callbacks we could have subclassed User to AdminUser and RegularUser, with each overriding the onCreate function. Although the pen
by Nition 4y ago
> Note that instead of using callbacks we could have subclassed User to AdminUser and RegularUser, with each overriding the onCreate function.
Although the pendulum has swung far from inheritance towards composition in recent years, this is surely a prime case for simply using a subclass and instantiating whichever one you want.