12/23/2023 0 Comments Solid principles liskov![]() Imagine a mission critical system that needs to shut down if an out of bounds happens, in this case the error would be missed as it would require the error handling class to have knowledge of all possible sub types in order to handle all the errors appropriate. The error handling code is not aware of subclass specific errors so is no longer able to handle them accordingly. If we run the code above we will now see a different error: So what happens if we replace our Lorry subclass with its new error and put it in place of the Vehicle super class? If we change line one to read: let vehicle : Vehicle = Lorry () Now if we run this code we see the below message in the console as expected:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |