I'm trying to make a class constructor within a namespace and I keep getting errors like: "'<variable>' is a nonstatic data member of class '<class>'" for when I try to setup parameters, and "Incomplete type is not allow" whenever I try to write out my function definition.
Here's what I'm doing:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
namespace test {
class blah;
}
class blah {
typedefint var[5];
public:
blah(); // Error here if I try something like, blah(): varthis(0) varthat(0)
staticconst var a;
staticconst var b;
staticconst var c;
};
test::blah::blah() // Error here that there is an incomplete type
{
}
Also I'm unsure why there is a parameter of 'const blah &' when I mouse over blah(); (using Visual Studio 2010) within the class definition. It tells me 'blah::blah(const blah &)' and I am unsure where the parameter comes from. How can I resolve these issues?
namespace test {
class blah {
typedefint var[5];
public:
blah(); // Error here if I try something like, blah(): varthis(0) vartha|| t(0)
staticconst var a;
staticconst var b;
staticconst var c;
};
blah::blah() // Error here that there is an incomplete type
{
}
} /* test */
A constructor 'blah::blah' that takes the argument 'const blah &' is a copy constructor. If you don't know what one of those is, I'm sure a Google search will find you plenty of explanations. If you don't create one for your class, the compiler will create one for you by default, so that's probably why Intellisense is offering it as a possible match.