Inheritance Demo in Java using three classes - Vehicle, Car, Plane

preview_player
Показать описание
⭕ Overview
In this video tutorial, I delve into the concept of inheritance in object-oriented programming, using a practical example involving vehicle classes. We begin by establishing a base class, named `Vehicle`, which serves as a foundation for various subclasses such as `Car`, `Plane`, and `Cargo`. This hierarchy not only demonstrates the relationship between parent and child classes but also exemplifies how common properties and methods can be shared and extended.

Throughout the session, I explain the significance of the parent class properties that are universally applicable to all subclasses, ensuring that the principles of DRY (Don't Repeat Yourself) are adhered to enhance code maintainability and scalability. I also touch upon more advanced topics such as abstract classes and interfaces, setting the stage for understanding their roles in a more structured codebase.

By the end of this video, you will have a clear understanding of how to efficiently structure your code when dealing with a hierarchy of objects that share common traits. This knowledge is crucial for writing clean, manageable, and reusable code in any object-oriented programming language.

If you find this video helpful, please give it a thumbs up, share it with your friends, and subscribe to my channel for more tutorials and insights into programming. Your support helps me create more content to assist you in your learning journey. Thank you for watching!

⭕ Chapters
0:00 - Introduction
2:35 - Creating the Vehicle class (Parent class)
11:45 - Creating the Car and Plane classes (Child classes)
13:15 - Creating instances of the Car and Plan classes

⭕ About me

⭕ My complete online training courses:

⭕ Check out my book:
Developing Business Applications for the Web: With HTML, CSS, JSP, PHP, ASP.NET, and JavaScript is available on Amazon and MC Press.
Рекомендации по теме
Комментарии
Автор

This is perfect for what I needed, thanks.
College students rise up and give this man a thumbs up. 😅

nathanamanuel
Автор

Thank you for making this video! Currently taking the Java class and having a rough time understanding the project around inheritance! this helped so much!!!

Redd
Автор

This is exactly what I needed, thank you! At 13:30 you create the variables outside your main method, why do you do that? You explain why, but I can't hear you clearly.

julian.castro
Автор

Hi! what if we have another class, e.g some Tank with fuel. How can we compare fuel in the Tank and fuel in Vehicle (Plane, Car etc) .Let's say we need check that fuel of any vehicle must be less than fuel of Tank. Thanks in advance

GreybackF
Автор

1. Create a class called Vehicle. Create subclasses Truck, Bus and Car. Add common methods in the base class and specific methods in the corresponding subclasses. Create a class called Road and create objects for Truck, Bus and Car and display the appropriate messages. Also, in the Vehicle class constructor, initialize the variables color, no of wheels and model. Give appropriate values for these variables from the invoking subclass. sir can you do this plzz

rockya
Автор

The worst explanation in the world. YouTube shouldn't even allow you to keep this channel. They should close this channel.

albinsopaj
welcome to shbcf.ru