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

Polymorphism and Interfaces

In this course we will break into a new concept of OOP programing. We will learn what polymorphism is and build up a full application using an interface.

Duration:

51:30

Created with

Ben Fhala

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.

Intro

we will create together updates to two of our visual inherited objects. explore with us how to work with visual inheritance.

04:01

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.

09:41

Integrating Intervals

Working with time in as3 as part of our inheritance practice.

06:20

Touchable

Before we can create a polymorphism we need to create a seperate class that isn't in our inheritance line

08:01

Hidden feature addFrameScript

An undocumented method for movieclips addFrameScript enables us to add frame script.

09:12

The is Operator

The is operator enables us to check and see if an object is a Object type.

03:08

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.

04:52

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.

03:50

Polymorphism in action

With our classes implementing the ITouchable interface its time for us to create together the first time together a Polymorphism.

02:25