Hello, in this JavaScript video I am going to show you the before I stop talking, I'm just messing with you. Can you get I'm sure you know it's method overriding the title of the video on the lesson. Okay, so method overriding, as you can see, we did inheritance. If you didn't check the video, I'd highly recommend going and have a look at that. And okay, so we have these three classes they inherit from here. It has a constructor, but you also have this function called vehicle funk.
And an actor I asked you to call the vehicle form of the car object and the boy object and our bike object we did, but the car object as well. Okay, so now that's done. What we're going to do is override the method in class and to override it. All we do is literally take the Exact same structure. But we do something else with method. So we're gonna say console dot log, we are going to first save that refresh, as you can see, when we call it from the car object.
And in the same the call object to possess, you know, a object of the car class, when we call it from the car object said this is the car class, whereas when we call it from the bike object is a dysfunction from the vehicles class. So we've overridden the method and all it all that is, is we are specifying a new structure, a new piece of code to be run in stead. So maybe you have this vehicle class and you have maybe a method for moving and you have a car you have a bike, you have one sort of vehicles can you have a claim though your vehicle as well you have a boat, those four vehicles and maybe Be the boat has a slightly different functionality compared to the call the bike and the plane for moving. And we could override the method without having to write a new separate method, therefore creating redundant code for the other free classes that have the exact same functionality.
So that's method overriding. If you have any questions, feel free to shoot me a message as usual. I look forward to seeing you in the next video.