How Can You Break the Liskov Substitution Principle?

AI Thread Summary
The discussion centers around the Liskov Substitution Principle (LSP), a key concept in object-oriented programming (OOP). The principle states that objects of a superclass should be replaceable with objects of a subclass without affecting the correctness of the program. Breaking this principle can occur in various ways, such as violating expected behavior, altering the return types, or introducing side effects in subclasses that are not present in the superclass. The initial inquiry reflects a desire for clarification on LSP, but the user expresses frustration after realizing the answer independently. This highlights the importance of understanding LSP in OOP to maintain code reliability and integrity.
Alek
Messages
7
Reaction score
0
Hello, everyone...
I am new to OOP, and this is the first time I make a question on PF, hope you can help me out. I am not sure about this principle.
Can you tell me in what ways I can *break* Liskov substitution principle ?

Thanks,

~Alek
 
Last edited:
Computer science news on Phys.org
Oh, forget about it!
I figured it out!
If I ewnt against the principle, I would break it!
Just thought my professor would chime in with a piece of advice or hints though.
I am relly angry and really disappointed !

~Alek sirsan
 
In my discussions elsewhere, I've noticed a lot of disagreement regarding AI. A question that comes up is, "Is AI hype?" Unfortunately, when this question is asked, the one asking, as far as I can tell, may mean one of three things which can lead to lots of confusion. I'll list them out now for clarity. 1. Can AI do everything a human can do and how close are we to that? 2. Are corporations and governments using the promise of AI to gain more power for themselves? 3. Are AI and transhumans...
Thread 'ChatGPT Examples, Good and Bad'
I've been experimenting with ChatGPT. Some results are good, some very very bad. I think examples can help expose the properties of this AI. Maybe you can post some of your favorite examples and tell us what they reveal about the properties of this AI. (I had problems with copy/paste of text and formatting, so I'm posting my examples as screen shots. That is a promising start. :smile: But then I provided values V=1, R1=1, R2=2, R3=3 and asked for the value of I. At first, it said...
Back
Top