“Differentiating between Type and Class”

var item:Vegetable;“”To write more flexible code, you have to differentiate between class and type. In the preceding example, Vegetable is both a class and the type. However, there is a correspondence between a type and an interface and between a (concrete) class and an implementation. Although a concrete class defines both an interface and implementation, an interface defines just the interface. Likewise, a class is also a type, but a type does not have to be a class. Types can also be interfaces. By declaring variables with interface types, you create greater flexibility in your code. Consider the following example:”var item:IProduce;

Wow, It is so deep. I am already on page 39 of ActionScript 3 with Design Patterns” by Lott and Patterson. Hopefully could get it done by the end of the summer!;)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: