02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoNext Video

Hello Inheritance

In this video we break into the idea of inheritance. We look into a real world example of different things that share features. 'Type of' is the key word(more in the next hour of content).

Video Transcript

00:01Today we are going to be talking about inheritance and to do that
00:05I just threw on the stage a few animals we put here a little illustration of a dog a cat in our
00:12Famous rabbit now all these animals share some commonalities. Of course, they all have their own
00:18Uniqueness as well, but they all share some things
00:21instead of us recreating everything from scratch each time imagine that
00:27Theoretically we could create an inheritance chain
00:29It's not only theoretically because that's what we're going to be doing
00:32Basically sharing between some features that all these animals have so already we establish is all these animals
00:37We could in theory group them up and say they all have some sort of commonality
00:42Alright, so they all are animals, right?
00:44Not only that they're all animals we could probably also determine that there's some stuff that they all do they all eat
00:50They all sleep. They all make noises. They all breathe
00:53They all have legs they have eyes, maybe some have more
00:58More legs less legs, you know, technically they all have the same amount of legs
01:03And then we put here one with a question mark
01:06Well here we see that two animals could wag their tail a cat and a dog could but I don't think rabbit could
01:13wag it still
01:14So we have to figure out a way how could create could we could create so probably by saying that then it'll probably be
01:20Safe to say that we probably can't say that every animal could wag their tail because not every animal has a tail, right?
01:27Alright, so so so far we've established the fact that we could probably create some sort of class that could represent all of these animals
01:35And that's what we're gonna do in our first step in our first step in the class
01:39We're actually going to create a class that could represent an animals class that could represent
01:43Any animal if it's a cat a dog or our rabbit
01:47The step after that is we're gonna have to figure out a way how could we leverage all this code that we created already and not
01:54recreate it and just adjust and change it to give a little bit more personality to our animals and to do that we're first gonna
02:00Start by example showing how we create this basic animal type and after we create the basic animal type
02:06We're gonna look at how to create unique scenarios for each of the animals
02:10So join me in the next hour or so where we're gonna be exploring the world of inheritance

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!