[Dev-C++] More Template Problems -- NewB
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Maya <Esc...@ne...> - 2003-12-28 14:11:26
|
Can someone please lend me a hand with this, I get the concept of a
template, but the dynamics are a bit complicated for me, can someone
please tell me why I get an error saying:
main.C: In function int main()
main.C:15:error: parse error before '.' token
Thanks
---------- index.C -----------
#ifndef JME_INDEX_H
#include "index.H"
#endif
------------ index.H ------------
#ifndef JME_INDEX_H
#define JME_INDEX_H
template<typename K, typename D>
class Index{
private:
K Key;
D Data;
public:
// C'tor
Index(K const& kx, D const& dx): Key(kx), Data(dx){ }
K const& getKey() const { return Key;}
}; //Index
} // jme
#endif
---------- main.C -----------
#include <string>
#include <iostream>
#include "index.H"
int main(){
const int i = 50;
const std::string name( "Maya" );
typedef jme::Index<const int, const std::string > T_index;
T_index( i, name );
////<<--- This is the probme //////
std::cout << T_index.getKey() << std::endl;
////<<--- This is the probme /////
std::cout << "End of Index..." << std::endl;
return 0;
}
--
FYI
http://www.astro.umd.edu/~marshall/abbrev.html
E-Mail Policy
http://www.vif.com/users/escalante/Email_Policy.html
* You cannot exercise your power to a point of humiliation.
- Jean Chretien
* The media's the most powerful entity on earth. They have the
power to make the innocent guilty and to make the guilty
innocent, and that's power.
- Malcom X
* "Innocent until proven guilty", no... not in Canada!!
|