struct in class -> problem...
I have a class, and that class contains an struct. but i am having problems returning the struct to main and read out the values the right way!.
Code:
void member::setgroup (Group thegroup)
{
TypeAcc = thegroup;
std::cout << TypeAcc.Type << std::endl;
std::cout << TypeAcc.CheckNum << std::endl;
} //setgroup function, everything works fine here.
Code:
Group member::getgroup () { return (TypeAcc); }// the problem?
Code:
int main ()
{
Group Newgroup;
Newgroup.Type = CharGroup[0] ;
Newgroup.CheckNum = ADMIN;
std::cout << Newgroup.Type <<"\n"<< Newgroup.CheckNum << std::endl;
member admin ("KaK","[email protected]",16,Newgroup );
Group N;
admin.getgroup() = N; // might be here...
std::cout << N.Type <<"\n"<< N.CheckNum << std::endl;
return 0;
}
output :
C:\Documents and
Code:
Settings\Sven\cbproject\ConsoleApp1\windows\Debug_Build\ConsoleApp1.exe
ADMIN -> GOOD
1 -> GOOD
ADMIN -> GOOD // these are the output functions called inside setgroup
1 -> GOOD
-> BAD // this is faulty, did i return TypeAcc wrong?
8 -> BAD // same
well, its got me wondering...