-2

Does using virtual methods violates LSP( L part of SOLID principles) or there are some exceptions?

Thanks in advance, Saghar Ayyaz

Péter Török
  • 114,404
  • 31
  • 268
  • 329
Saghar
  • 693
  • 2
  • 12
  • 24
  • 1
    Can you post an example? In particular one that you think may be an LSP violation? – Oded Jul 23 '10 at 09:22

1 Answers1

1

Why do you think that? Virtual methods in themselves are just a mechanism for polymorphism. The Liskov Substitution Principle is a just constraint on how you implement the overrides (and other aspects of descendant classes) in order to get predictable polymorphic behaviour.

Pontus Gagge
  • 17,166
  • 1
  • 38
  • 51