I am finding it very difficult to understand this concept. I had a couple of questions in my mind about it. I've tried checking online but there's not much resources out there about it.
Does the subclass need to retain its distinctiveness throughtout its entire life?
I am pretty sure that LSP defines a contract between a super and a sub class, correct me if i am wrong.
What if a given function uses some object, can you replace the object with one of it's sub classes without breaking it's execution?
Will the program still work if there is a variable whose type is a super class. If I place an instance of that super class or any of the sub classes into that variable.
I am sorry if this didnt make sense. These 4 questions are bothering me about LSP.
Thank you very much
Aucun commentaire:
Enregistrer un commentaire