Inheritance gone wrong
Read OriginalThis technical article analyzes a common design flaw in object-oriented programming using Java's Stack class as an example. It explains how inheriting from the Vector class exposes inappropriate methods (like random insertion), violating the LIFO principle. The author proposes solutions like composition/delegation and depending on interfaces rather than concrete implementations to enforce proper encapsulation and design.
Comments
No comments yet
Be the first to share your thoughts!
Browser Extension
Get instant access to AllDevBlogs from your browser