just one more question, I hope you will still read this:
when making a class, and I want to call another class function within a class function, do I have to use Class name, or just function? (instanced)
e.g.:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
class myclass
{
public:
void Function1();
int Function2();
};
void myclass::Function1()
{
myclass::Function2();
}
int myclass::Function2()
{
return 1;
}
|
OR
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
class myclass
{
public:
void Function1();
int Function2();
};
void myclass::Function1()
{
Function2();
}
int myclass::Function2()
{
return 1;
}
|
which one should I use, when I want to call function 2 with a instanced class, like this
1 2 3 4 5
|
int main()
{
myclass a;
a.Function1();
}
|
I want "a" to call a Function2 (from function 1), not to call Function2 as from class, I hope u understand :D
like, I want to run the function within the instance of that class, not in class by default
e.g. I want to call function Function2 from A, so the code should work like this
a.Function2();
and NOT like this
myclass::Function2();
so should I use the CLASSNAME:: in the function within the function, or just call the function?