Java Inheritance: Building a Hospital Management System

🚀 Day 2 of Learning Object-Oriented Programming (Java) Today I tackled one of the 4 core pillars of OOP — Inheritance! Instead of just reading theory, I built a Hospital Management System from scratch to understand how inheritance works in real code. Here's what I implemented today: ✔ Created a Person base class with shared fields (name, age) ✔ Extended it into Doctor, Patient and Nurse child classes ✔ Used super.displayInfo() to reuse parent class methods ✔ Applied @Override to properly redefine methods in child classes ✔ Followed Java naming conventions (camelCase) The biggest concept that clicked today: ➡ A parent class holds common data — written once, reused everywhere ➡ A child class inherits everything and adds its own unique behavior ➡ @Override lets you redefine a parent method while keeping the same structure Started with messy code, got feedback, fixed it, and improved — that's the real learning process! 💪 Next up → Polymorphism 🔥 #Java #OOP #Inheritance #ProgrammingJourney #ComputerScience #LearningInPublic

  • No alternative text description for this image

To view or add a comment, sign in

Explore content categories