I know it might be a silly question to ask, but I didn’t quite get an a absolute clear answer on this matter, so I thought I’d put it here.
Does c++ support the subtyping in the sense that it fulfills Liskov’s principle fully? I understand how parametric polymorphism, inclusion polymorphism(subclassing and overriding) work in c++ but I’m not entirely sure or understand if subtyping exists in the context of C++. Could you please explain?
Does c++ support the subtyping in the sense that it fulfills Liskov’s principle fully?
C++ is fully capable of supporting the Liskov Substitution Principle if the programmer uses it that way. Just like many other languages, it will not prevent you from doing something that violates the principle.
And yes, both “conventional” polymorphism achieved by inheritance and parameteric/static polymorphism provided by template shenanigans work as far as this question is concerned.