multiple class file (constructor with default value)
can someone help me with this code plz
I dont know what the error is.
in my container.h file i made constructor under public
|
Container(int maxCapacity = DEFAULT);
|
where i set
and in my container.cpp file where i implement
1 2 3
|
Container(int maxCapacity = DEFAULT){
//.. my code
}
|
I get error message of
container.cpp:17: error: expected unqualified-id before "int"
container.cpp:17: error: expected `)' before "int"
any ideas on whats going on?
Please correct cpp file to the following view
1 2 3
|
Container(int maxCapacity){ //you don't need to specify default param in cpp file
//.. my code
}
|
I still get same error message
container.cpp:17: error: expected unqualified-id before "int"
container.cpp:17: error: expected `)' before "int"
:(
I changed the code to
1 2 3
|
Container::Container(int maxCapacity){
// my code
}
|
and got no error message.
Can anyone explain to me why I got error message before?
or what the actualy error message means?
Last edited on
Topic archived. No new replies allowed.