Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changes between Version 2 and Version 3 of InternalTemplatesExample

Show
Ignore:
Author:
jcc7 (IP: 192.149.244.9)
Timestamp:
11/07/06 17:41:50 (17 years ago)
Comment:

fixed newsgroup links

Legend:

Unmodified
Added
Removed
Modified
  • InternalTemplatesExample

    v2 v3  
    7272---- 
    7373 
    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]:'' 
    7575 
    76 Is that not incorrect? The spec clearly states (http://www.digitalmars.com/d/template.html) that "Templates cannot be  
     76Is that not incorrect? The spec clearly states (http://www.digitalmars.com/d/template.html) that "Templates cannot be 
    7777used 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. 
    7878 
    7979---- 
    8080 
    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]:'' 
    8282 
    8383That 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. 
    8585---- 
    8686 
    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]:'' 
    8888 
    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.  
     89Though 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. 
    9090 
    9191---- 
    9292 
    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]:'' 
    9494 
    9595I 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. 
    9999== Source == 
    100100 
    101 || Link || http://www.dsource.org/tutorials/index.php?show_example=116 || 
    102101|| Posted by || Anonymous || 
    103102|| Date/Time || Fri Sep 10, 2004 12:03 pm ||