Changes between Version 2 and Version 3 of InternalTemplatesExample
- Timestamp:
- 11/07/06 17:41:50 (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
InternalTemplatesExample
v2 v3 72 72 ---- 73 73 74 ''From http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.announce/2201:''74 ''From [http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.announce&artnum=2201 digitalmars.D.announce:2201]:'' 75 75 76 Is that not incorrect? The spec clearly states (http://www.digitalmars.com/d/template.html) that "Templates cannot be 76 Is that not incorrect? The spec clearly states (http://www.digitalmars.com/d/template.html) that "Templates cannot be 77 77 used to add non-static members" to classes. This is precisely what that example does, and the funny thing is that it compiles and runs ok. I don't see how that can work, unless the compiler is treating the templated method as final. 78 78 79 79 ---- 80 80 81 ''From http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.announce/2206:''81 ''From [http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.announce&artnum=2206 digitalmars.D.announce:2206]:'' 82 82 83 83 That is incorrect. Though I think templates can not add virtual members to classes (ie. I believe template methods are implicitly final). Though I have not tested this to be sure. 85 85 ---- 86 86 87 ''From http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.announce/2207:''87 ''From [http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.announce&artnum=2207 digitalmars.D.announce:2207]:'' 88 88 89 Though the spec says a mixin *can* add virtual functions to a class. That said, I recently encountered a problem whereby a class method refused to override the templated version. 89 Though the spec says a mixin *can* add virtual functions to a class. That said, I recently encountered a problem whereby a class method refused to override the templated version. 90 90 91 91 ---- 92 92 93 ''From http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.announce/2211:''93 ''From [http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.announce&artnum=2211 digitalmars.D.announce:2211]:'' 94 94 95 95 I expanded that example a bit to use inheritance and it looks like the documentation is wrong... Not only are the functions non-static and non-final but are (correctly) virtual as well. 99 99 == Source == 100 100 101 || Link || http://www.dsource.org/tutorials/index.php?show_example=116 ||102 101 || Posted by || Anonymous || 103 102 || Date/Time || Fri Sep 10, 2004 12:03 pm ||