codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Template  dickyDick at 19:51 on Thursday, July 28, 2005
 

Hi all,

I am having trouble with class definition with template. The following is a simple example:


template <class DataType>
struct TestStruct {
DataType key;
};

template <class s, class d>
class DummyClass {
public:
d getKey(s<d> *var) {
return var->key = 10;
}
};

int main() {
DummyClass<TestStruct, double> myClas;
return 0;
}

It produces an error because of s<d>.

If I write:


template <class DataType>
struct TestStruct {
DataType key;
};

template <class s, class d>
class DummyClass {
public:
d getKey(s *var) {
return var->key = 10;
}
};

int main() {
DummyClass<TestStruct<double>, double> myClas;
return 0;
}

It works just fine. But that is not I want because I need to use "double" twice. Can anyone help?








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Re: Problem with concatenation
•  how to genrates the crystal report by sending a id at runtime
•  help me
•  pls help me with this..
•  Re: Security - Code verify
•  Job @ EarlySail
•  Job @ EarlySail (perl)
•  IPC problem
•  Re: import contacts of msn/yahoo


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007