|
here is the code and error:
#include <iostream>
using namespace std;
#include <stdlib.h>
template <class T>
bool checkLim(const T& val, const T& limit)
{
return val>limit;
}
template <class T>
class CheckLimit
{
T limit;
public:
CheckLimit(const T& _limit):limit(_limit)
{
}
bool operator() (const T& value)
{
// return value<limit;
return checkLim<T>(value,limit);
}
};
int main (int argc, char** argv)
{
int limit = atoi(argv[1]);
cout<<limit<<endl;
CheckLimit<int> check_limit(100);
if(check_limit(limit))
{
cout<<"too little"<<endl;
}
else
cout<<"too big"<<endl;
return 0;
}
error:**** Build of configuration Debug for project checklimit ****
make all
Building target: checklimit
Invoking: GCC C++ Linker
g++ -o"checklimit" ./checkLimit.o
./checkLimit.o: file not recognized: File truncated
collect2: ld returned 1 exit status
make: *** [checklimit] Error 1
|