OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of dart.core; | 5 part of dart.core; |
6 | 6 |
7 /** | 7 /** |
8 * The base class for all Dart objects. | 8 * The base class for all Dart objects. |
9 * | 9 * |
10 * Because Object is the root of the Dart class hierarchy, | 10 * Because Object is the root of the Dart class hierarchy, |
11 * every other Dart class is a subclass of Object. | 11 * every other Dart class is a subclass of Object. |
12 * | 12 * |
13 * When you define a class, you should override [toString] | 13 * When you define a class, you should override [toString] |
14 * to return a string describing an instance of that class. | 14 * to return a string describing an instance of that class. |
15 * You might also need to define [hashCode] and [==], as described in the | 15 * You might also need to define [hashCode] and [==], as described in the |
16 * [Implementing map keys] | 16 * [Implementing map |
17 * (http://www.dartlang.org/docs/dart-up-and-running/contents/ch03.html#ch03-imp
lementing-map-keys) | 17 * keys](https://www.dartlang.org/docs/dart-up-and-running/ch03.html#implementin
g-map-keys) |
18 * section of the [library tour] | 18 * section of the [library |
19 * (http://www.dartlang.org/docs/dart-up-and-running/contents/ch03.html). | 19 * tour](http://www.dartlang.org/docs/dart-up-and-running/contents/ch03.html). |
20 */ | 20 */ |
21 class Object { | 21 class Object { |
22 /** | 22 /** |
23 * Creates a new [Object] instance. | 23 * Creates a new [Object] instance. |
24 * | 24 * |
25 * [Object] instances have no meaningful state, and are only useful | 25 * [Object] instances have no meaningful state, and are only useful |
26 * through their identity. An [Object] instance is equal to itself | 26 * through their identity. An [Object] instance is equal to itself |
27 * only. | 27 * only. |
28 */ | 28 */ |
29 const Object(); | 29 const Object(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 * equality operator as well to maintain consistency. | 71 * equality operator as well to maintain consistency. |
72 */ | 72 */ |
73 external int get hashCode; | 73 external int get hashCode; |
74 | 74 |
75 /** | 75 /** |
76 * Returns a string representation of this object. | 76 * Returns a string representation of this object. |
77 */ | 77 */ |
78 external String toString(); | 78 external String toString(); |
79 | 79 |
80 /** | 80 /** |
81 * [noSuchMethod] is invoked when users invoke a non-existent method | 81 * Invoked when a non-existent method or property is accessed. |
82 * on an object. The name of the method and the arguments of the | |
83 * invocation are passed to [noSuchMethod] in an [Invocation]. | |
84 * If [noSuchMethod] returns a value, that value becomes the result of | |
85 * the original invocation. | |
86 * | 82 * |
87 * The default behavior of [noSuchMethod] is to throw a | 83 * Classes can override [noSuchMethod] to provide custom behavior. |
88 * [NoSuchMethodError]. | 84 * |
| 85 * If a value is returned, it becomes the result of the original invocation. |
| 86 * |
| 87 * The default behavior is to throw a [NoSuchMethodError]. |
89 */ | 88 */ |
90 external dynamic noSuchMethod(Invocation invocation); | 89 external dynamic noSuchMethod(Invocation invocation); |
91 | 90 |
92 /** | 91 /** |
93 * A representation of the runtime type of the object. | 92 * A representation of the runtime type of the object. |
94 */ | 93 */ |
95 external Type get runtimeType; | 94 external Type get runtimeType; |
96 } | 95 } |
OLD | NEW |