[Dev-C++] how to fix class member error
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Dane E. <dg...@wo...> - 2005-10-04 20:28:49
|
Hi all,
Thank you in advance for any help you can offer.
Im trying to write a simple-stupid template class and it keeps
sigaborting. I cant figure out what I am doing wrong, please can someone
have a look to help me solve this?
Here is the error that I get:
ZeroLink: unknown symbol '__ZN7accountIfED1Ev'
ATMapp has exited due to signal 6 (SIGABRT).
Explanation: I had 2 files: main.cpp, and account.h
//main contents:
#include <iostream>
#include "account.h"
int main () {
int test;
account<float> user(3.33);
test = user.getData();
return 0;
}
//account.h contents:
template <class Type>
class account
{
public:
//CONSTRUCTOR
account(Type bal);
~account();
int getData();
private:
int id;
int pin;
Type balance;
};
template <class Type>
account<Type>::account(Type bal)
{
id = 1;
balance = bal;
pin = 522;
}
template <class Type>
int account<Type>::getData()
{
return pin;
}
---------------------------------------------
Best regards,
Dane
da...@de...
|