#include <iostream>
usingnamespace std;
class CLASS
{
public:
void Function();
void Function2(int seven);
};
int main()
{
int seven = 7;
CLASS ClsObj;
ClsObj.Function();
cout << "\n";
CLASS ClsObj2;
ClsObj2.Function2(seven);
}
void CLASS::Function()
{
cout << "shit fuck" << endl;
}
void CLASS::Function2()
{
int six = 6;
cout << six + seven << endl;
}
C:\Users\Chay Hawk\Desktop\Classes\main.cpp|32|error: prototype for 'void CLASS::Function2()' does not match any in class 'CLASS'|
C:\Users\Chay Hawk\Desktop\Classes\main.cpp|9|error: candidate is: void CLASS::Function2(int)|
||=== Build finished: 2 errors, 0 warnings ===|
Like every other function you define, the definition must match the declaration.
1 2
void CLASS::Function2(int seven)
// ...
You should really stop using all caps for class and/or function names. Typically if a person sees something in all caps, it means that text was #define'd somewhere.
ok, but i thought i was using a class and all that to prevent having to reference stuff in parameters though. is there a way to do it without putting int seven in void CLASS::Function2() ??
I didnt know about the all caps thing, i'll try to use lowercase.