Skip to main content
2 of 2
edited body
Basilevs
  • 3k
  • 1
  • 17
  • 17

LSP does not apply to constructors because in most languages instantiation is impossible without explicit type specification. Therefore the only contract for MySpecialLabel() is not to break internal lifetime scoped invariants which is impossible anyway in OOP languages.

So you code violates LSP no more than any Java code using objects without creation patterns.

Basilevs
  • 3k
  • 1
  • 17
  • 17