I'm currently learning about classes, and I'm trying to make a simple program to create, and show information about a member of a club, guild, etc.
Here is part of my code so far:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
class Member {
private:
char *name;
int age;
int rank;
public:
static Mem(char *name, int age, int rank);{
Member::name = name;
Member::age = age;
Member::rank = rank;}
static Member::ShowMember();{cout << "\nName: " << name << "\nAge: " << age << "\nRank: " << rank;}
};
int main ()
{
HANDLE hOut; hOut = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hOut, BRIGHT_YELLOW);
char *name;
int age;
int rank;
Member::Mem("BillyBob", 27, 6);
Member::ShowMember();
wait(40); //user-defined function
return 0;
}
|
Here is the compiler/debugger output:
[ln 7]error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
[ln 7]error C2059: syntax error : '{'
[ln 7]error C2334: unexpected token(s) preceding '{'; skipping apparent function body
[ln 11]error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
[ln 11]error C2059: syntax error : '{'
[ln 11]error C2334: unexpected token(s) preceding '{'; skipping apparent function body
-------------
I am using Visual studio 2008.
Can someone please tell me what's wrong so I can better understand classes?
Thanks,
Zach