Re: Template Class
On 9/29/2012 10:14 AM, Rene Ivon Shamberger wrote:
This code help you?
I just might be that I tired, but I cannot see anything wrong in this code.
I think you need to take a break from that code.
Only a couple of things are wrong. (A) 'jme' is undefined. You've been
told it already, but you don't seem to pay enough attention, which
suggests that you need to have a fresh start.
Fix: Remove all instances of "jme::" from this program.
(B) 'cout' is undefined.
Fix: Add #include <iostream> to the top of the code.
(C) There are two variables named 'd' in the 'main' function.
Fix: Rename one of them.
After that your program will compile. Will that help? I am not sure.
Again, you definitely *need a break*. Use this opportunity, go out, get
a rest. Get drunk, if that helps. Get laid. Just get your mind off
that program - it's no use keeping at it if your brain has stopped working.
template <class T> class Data{
private:
T data;
public:
Data();
Data(T);
virtual ~Data();
};
template <class T>
jme::Data<T>::Data() {}
template <class T>
jme::Data<T>::Data(T _data) {
this->data = _data;
}
template <class T>
jme::Data<T>::~Data() {}
.............
using namespace std;
int main() {
jme::Data<int> d(1); // this does not work
jme::Data<int> d; // this does not work
cout << "Hello world!" << endl;
return 0;
}
V
--
I do not respond to top-posted replies, please don't ask