Chapter 10 Example 2
♥0 |
Line 28 |
Modified 2009-06-09 03:48:44 |
MIT License
archived:2017-03-09 12:11:24
ActionScript3 source code
/**
* Copyright actionscriptbible ( http://wonderfl.net/user/actionscriptbible )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/lfzw
*/
package {
import com.actionscriptbible.Example;
import flash.utils.Dictionary;
public class ch10ex2 extends Example {
public function ch10ex2() {
var guy1:Person = new Person("Bob");
var guy2:Person = new Person("Charlie");
var girl1:Person = new Person("Alice");
var girl2:Person = new Person("Alice");
var notes:Dictionary = new Dictionary();
notes[guy1] = "Likes games";
notes[guy2] = "Super organized";
notes[girl1] = "Enjoys drawing";
notes[girl2] = "Plays piano";
trace(girl1, notes[girl1]);
trace(girl2, notes[girl2]);
}
}
}
class Person {
public var name:String;
public function Person(name:String) {
this.name = name;
}
public function toString():String {
return name;
}
}