LESSON 7: about this prefix

1 view
Skip to first unread message

alvin_biophile

unread,
Jan 20, 2010, 8:07:14 AM1/20/10
to Flex 3:Training from the Source
on page 183

STEP 3

public function Category(id:int,catName:String){
this.catID-id;
this.catName=catName;
}

In the constructor function both catID and catName are preceded by the
this prefix....

However, Just under the code, it is said that...

When the property names match the parmeter names, this prefix must be
there...

I'm confused... because here just catName is named the same, but as a
parameter name 'id' is used and property name is 'catID' ...

so according to the explanation catID doesn't require the this prefix,
doesn't it??

Michael Labriola

unread,
Jan 21, 2010, 9:35:14 PM1/21/10
to Flex 3:Training from the Source

Correct, if they match it is required. If they do not match, it is not
required, it is optional.
Reply all
Reply to author
Forward
0 new messages