Interfaces allow 'Polymorphism'. Many say this is OOP's greatest
contribution to computer science.

Polymorphism occurs when a superclass stands in for a subclass. This is
extremely useful when you don't know exactly what type of class (usually a
concrete class) is needed at a specific spot within your code. Example:

class Vehicle extends Sprite
-----------------------------------------
class Car extends Vehicle
class Boat extends Vehicle
class Plane extends Vehicle

Using the above, you can declare an attribute as type Vehicle in any spot
where you don't know exactly which of the 3 vehicle types the application
will be operating on.

There needs to be a way (in my opinion) to define a type, it's
methods/properties and whether these methods/properties are public or
private. Also, you should be able to define concrete implementation within
these methods.

As I understand it, the closest you can get to what I've described above, is
an abstract class which implements an interface, and methods within the
abstract class throw an error - to make sure that a class extending the
abstract overwrites said methods.

Any thoughts on this?
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to