TypeScript · Middle · Question 12 of 75
What is an abstract class for?
- ✓Correct answer: A base class with shared code and abstract methods, not instantiable with
new - 2A class without methods, used only as a type for checks
- 3A class whose methods and properties are all static
Explanation
abstract class Repo { abstract find(id): T; log() {...} } - subclasses must implement find and get log ready-made. Unlike an interface, an abstract class exists at runtime and can contain code and state.