Here is my radical opinion on OOP: oop is a term made to advertise certain teaching practices, and promote certain, more or less arbitrarily chosen, programming languages and programming features. The main purpose of OOP is to serve, directly or indirectly, the benefit of the teachers. |
hanst wrote: |
---|
You can't pass a tower to a method expecting a Stack and expect it to work. Stacks and Towers aren't interchangeable, hence a Tower is not a Stack |
|
|
hanst99 wrote: |
---|
You can't pass a tower to a method expecting a Stack and expect it to work. |
Disch wrote: |
---|
You cannot do everything with a tower that you can with a stack. Therefore it's (IMO) a poor use of inheritance. |
The towers are supposed to check rings that passed to them, and throw an exception if a user tries to put a larger on a smaller one. That's why I'm saying it's a silly solution. |
It throws an exception? That's hilarious. I think at this point you should just discard most of the BS that your professor seems to throw at you and get whatever you can out of your textbook if you have one. This does not, however, mean that you should give up on the "teachability," of programming. Whether or not your professor isn't a very good programmer, it's not worth saying "it is forbidden to teach good OO practices." People have been complaining that CS degrees/programs are a waste of time for years, anyhow. |