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

Intro

Before moving into polymorphism we will continue the build of our oop examples we where working on in the last course. we will create together updates to two of our visual inherited objects. explore with us how to work with visual inheritance.

Video Transcript

00:00Hello, hello, hello, hello, hello. Alright, so our main topic in the next hour is going to be polyformism and interfaces
00:08And it's actually harder to pronounce than it actually is
00:11I'm gonna say just as an intro to this that for years
00:15I heard that word polyformism and it just scared the shit out of me and
00:20In other words, I just avoided it because I had no idea what it actually meant until I actually really understood what it meant
00:27And why and what interfaces are and then I started using them and actually I used this much more than I use inheritance
00:35So with that said let's jump right in now before we're going to complete this exercise of polyformism and interfaces
00:43I I did a couple of changes in our code that I want to complete them together and then we'll move into the next phase of
00:50polyformism and
00:52Interfaces, so what I've done is I created a new class for the cat
00:56But even before I've done that I've changed our our directory path our package to o2 geek and notice this
01:03Oh, which is actually the letter O capitalized and the reason is is just because
01:08You're not allowed to start a package name with a digit. So in line with our new domain name
01:14I changed it to o2 geek as our main directory for our samples from now on
01:20Inside of the ope folder you'll find still the inheritance folder, but I created a new folder which is called polyformism
01:26Which we're going to put our poly for mystic classes into there and we'll find out what those are
01:32Momentarily more like in another 20 or 30 minutes. So before we do that, I've created a new class
01:37That's called cat and I just copied out the dog class
01:40So if and by the way, um
01:42Probably imported to say is I updated also the name paths for our packages making sure that they're going to the right path
01:48to all the different classes and I've gone through the different linkages right clicking on it going to the properties and
01:55Making sure that our name is defined to the right location now that I've changed the name to zero to geek from our old name
02:03Alright, so that's that's the intro and let's get started with
02:08Updating our class now our first task that I'm going to do until now we were working with events and we were working with with
02:15With inheritance, but we didn't do anything visual with it
02:18So I just want to add a little bit of layer of visibility to our elements which to do that
02:24And download the latest source files. You'll see that I created two separate layers for the dog. One is actually the tail and
02:33All the real all the tail is really doing is just wagging itself and I've created a mouth as well
02:38very very simple mouth and tail and all we're really doing here is our dog is kind of like barking and wagging his tail and
02:47That's our dog I turned it into a nice little
02:51Animation on the timeline and with the cat I did something way more simple
02:55We have our relaxed and we have our tons and that's really all the visual changes that I made that you could download or create yourself
03:02And yeah, I know my cat isn't that cute, but you know
03:07That's what you get when you get a programmer to draw things
03:11Alright, so next on is for next on for us. And by the way, I add to your little tick
03:16You know, you never know which animals tick it is, but it could be of the cat or of the dog
03:22Just something completely random. Alright, so we got that out of the way
03:26Let's start building our application and really what I want to do is whenever
03:30The dog is clicked on that he'll wag his tail once and whenever the cat is clicked on if we click on it
03:37more than three times then it's going to get agitated if and
03:43Slowly relax back and that's that's going to be the core of the idea
03:47So we'll start from the dog
03:48The dog is easier to complete then we'll do the cat and then we'll be done with our
03:52Inheritance chain objects and we'll move on to our next topic of objects that are not in our inheritance chain
04:00All right

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!