Polymorphism and Interfaces
Duration: 51:30
Created with
Ben Fhala
Ben Fhala is the creative force and founder behind 02geek, a pioneering platform dedicated to making web development accessible to everyone. With over 18 years of experience in the industry, Ben has a deep passion for teaching and a knack for breaking down complex concepts into easy-to-understand lessons.
Polymorphism and Interfaces Overview
What you'll learn
We are reaching another large step in our training. In the next hour we will continue and build on the OOP skills we developed so far. We will continue and refine our last examples and then move on to a new topic polymorphism. Polymorphism even though it has a very scary name is actually a very easy concept as long as you ignore its name. Polymorphism enables us to treat many object types as if they where one type of object. The idea behind it is to treat objects based on what they do instead of what they are. In the process we will discover the glue that will make it possible - we will create an interface and then integrate it into our logic and show case how it works.
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!Intro
we will create together updates to two of our visual inherited objects. explore with us how to work with visual inheritance.
Overriding built in methods
Not only methods we create yourself can be overridden. Actually built in methods can be overridden as well. In this example we will show you how to override the play and stop methods of the movieclip.
Integrating Intervals
Working with time in as3 as part of our inheritance practice.
Touchable
Before we can create a polymorphism we need to create a seperate class that isn't in our inheritance line
Hidden feature addFrameScript
An undocumented method for movieclips addFrameScript enables us to add frame script.
The is Operator
The is operator enables us to check and see if an object is a Object type.
Our first Interface
The steps involved to create an interface are very easy. The most important thing to understand is what an interface actually is.
implements
Learn how to tell a class to implement an interface i AS3. In the last video we created an interface and in this one we will define what objects are a type of that interface and what are not.
Polymorphism in action
With our classes implementing the ITouchable interface its time for us to create together the first time together a Polymorphism.
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!