On 21 Jan 2006, at 21:19, Nathan Derksen wrote:
The variables that you are passing through the constructor actually obscure those two properties because they share the same variable name;
...
Third, it's good to name private properties using a naming convention that allows you to easily identify in your code the fact that it is a class property. I prepend a "p" to the variable name, others like prepending a "_" character. Do whatever you want, just use it consistently.

Not wishing to diminish Nathen's advise, it may be useful to know how to distinguish between parameters and properties sharing the same name in a class...

class Example
{
  private var theNum : Number;   // class property

  function Example()
  {}

  public function changeNum( theNum : Number ):Void
  {

// to set class property theNum to the value of method parameter theNum

    this.theNum = theNum;
  }
}


Paul
--
[ http://www.creative-cognition.co.uk/ ]


_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to