Changeset 1365
- Timestamp:
- 12/06/09 09:12:15 (15 years ago)
- Files:
-
- trunk/docsrc/expression.dd (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/docsrc/expression.dd
r1347 r1365 971 971 It is an error if those 972 972 bounds are out of range. 973 973 ) 974 974 975 975 <h2>Primary Expressions</h2> 976 976 977 977 $(GRAMMAR 978 978 $(GNAME PrimaryExpression): 979 979 $(I Identifier) 980 980 $(B .)$(I Identifier) 981 $( B this)982 $( B super)981 $(LINK2 #this, $(B this)) 982 $(LINK2 #super, $(B super)) 983 983 $(LINK2 #null, $(B null)) 984 984 $(B true) 985 985 $(B false) 986 986 $(B $) 987 987 $(V2 988 988 $(B __FILE__) 989 989 $(B __LINE__)) 990 990 $(I NumericLiteral) 991 991 $(GLINK CharacterLiteral) 992 992 $(GLINK StringLiterals) … … 1002 1002 $(B $(LPAREN)) $(I Expression) $(B $(RPAREN)) 1003 1003 $(V2 1004 1004 $(I TraitsExpression)) 1005 1005 ) 1006 1006 1007 1007 <h3>.Identifier</h3> 1008 1008 1009 1009 $(I Identifier) is looked up at module scope, rather than the current 1010 1010 lexically nested scope. 1011 1011 1012 <h3> this</h3>1012 <h3>$(LNAME2 this, this)</h3> 1013 1013 1014 1014 $(P Within a non-static member function, $(B this) resolves to 1015 1015 a reference to the object for which the function was called. 1016 1016 If the object is an instance of a struct, $(B this) will 1017 1017 be a pointer to that instance. 1018 1018 If a member function is called with an explicit reference 1019 1019 to $(B typeof(this)), a non-virtual call is made: 1020 1020 ) 1021 1021 1022 1022 ------------- … … 1036 1036 void main() 1037 1037 { 1038 1038 B b = new B(); 1039 1039 1040 1040 b.foo(); // returns 'A' 1041 1041 b.bar(); // returns 'B' 1042 1042 } 1043 1043 ------------- 1044 1044 1045 1045 1046 <h3> super</h3>1046 <h3>$(LNAME2 super, super)</h3> 1047 1047 1048 1048 $(P $(B super) is identical to $(B this), except that it is 1049 1049 cast to $(B this)'s base class. 1050 1050 It is an error if there is no base class. 1051 1051 It is an error to use $(B super) within a struct member function. 1052 1052 (Only class $(TT Object) has no base class.) 1053 $(B super) is not allowed in struct member1054 functions.1055 1053 If a member function is called with an explicit reference 1056 1054 to $(B super), a non-virtual call is made. 1057 1055 ) 1058 1056 1059 1057 <h3>$(LNAME2 null, null)</h3> 1060 1058 1061 1059 $(P $(B null) represents the null value for 1062 1060 pointers, pointers to functions, delegates, 1063 1061 dynamic arrays, associative arrays, 1064 1062 and class objects.
