-
Quick class question
Hi everyone :)
I made a class with 4 private variables of the type int, int, bool, bool respectively. Say I called it "MyClass". I write the constructors and functions to retrieve the private variables and it all compiles. So far so good.
The trouble occurs when I try to use the constructor of the form
Code:
int a = 5;
int b = 2;
bool c = true;
bool d = false;
MyClass C = (a, b, c, d);
I get the error msg
"conversion from `bool' to non-scalar type `MyClass' requested"
Anyone know what's wrong? It isn't obvious to me and I can't think where to look.
I can post more source code if people would like
Kind Regards
Stonehambey :)
-
probably = should not be there...
you are trying to assign to your C var the result of (a,b,c,d) which is d - read the "operator , " description
-
That seems to have worked, thanks :)
I'll read up on what you suggest