Somedays, I hate programming.
Just working through the chapter on references and as part of an exercise I've created myself a tiny test class that I can instantiate. Here's the parts:
TestObject.h
TestObject.cpp
Visual Studio tells me:
MSDN doesn't give any more useful information. Anyone see where I've specified a return type for my constructor? Hmm? NOWHERE! Stupid dumbass code.
Help?
Just working through the chapter on references and as part of an exercise I've created myself a tiny test class that I can instantiate. Here's the parts:
TestObject.h
Code:
class TestObject
{
public:
TestObject();
~TestObject();
void SetI(int i);
int GetI() const;
private:
int i;
}
TestObject.cpp
Code:
#include "TestObject.h"
TestObject::TestObject()
{
this->i = 1;
}
TestObject::~TestObject()
{
}
void TestObject::SetI(int i)
{
this->i = i;
}
int TestObject::GetI() const
{
return this->i;
}
Visual Studio tells me:
Error said:Error 1 error C2533: 'TestObject::{ctor}' : constructors not allowed a return type c:\documents and settings\paul marshall\my documents\_development\cpp learning\chapter8\c8exercises\testobject.cpp 4
MSDN doesn't give any more useful information. Anyone see where I've specified a return type for my constructor? Hmm? NOWHERE! Stupid dumbass code.
Help?