home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 32,635 of 33,346   
   Marc to Klaus   
   Re: template syntax problem   
   04 Nov 12 00:00:18   
   
   From: marc.glisse@googlemail.com   
      
   Klaus  wrote:   
      
   >    6 class MyClass   
   >    7 {   
   >    8    public:   
   >    9       template   
   >   10          static T AnyFunc();   
   >   11   
   >   12 };   
   >   13   
   >   14 template <> int MyClass::AnyFunc () { return 1; }   
   >   15 template <> double MyClass::AnyFunc() { return 2.2222; }   
   >   16   
   >   17   
   >   18 template    
   >   19 class Y   
   >   20 {   
   >   21    public:   
   >   22       T Caller() { return X::AnyFunc(); }   
      
   X::template Anyfunc()   
      
   >   23 };   
   >   24   
   >   25 //template    
   >   26 //T Y::Caller() { return X::AnyFunc(); }   
   >   27   
   >   28 int main()   
   >   29 {   
   >   30   
   >   31    Y yi;   
   >   32    cout << yi.Caller() << endl;   
   >   33   
   >   34    Y yd;   
   >   35    cout << yd.Caller() << endl;   
   >   36   
   >   37    return 0;   
   >   38 }   
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca