S
shanknbake
I'm getting the following compile-time error:
error C2352: 'Person::getCount' : illegal call of non-static member
function
Here is my getCount function declaration:
-----------------------------------------------------------------------------------
//person.h
class Person
{
....
public:
...
int getCount();
}
----------------------------------------------------------------------------------
//person.cpp
int Person::getCount()
{
return count;
}
----------------------------------------------------------------------------------
//test.cpp
int main()
{
....
for (int i = 0; i < Person::getCount(); i++)
persPtr->print();
int total = Person::getCount();
....
}
-----------------------------------------------------------------------------------
Do you see something that I don't? Mind I'm a bit of a beginner with C+
+. I've spent far too long trying to figure this one out.
Thanks in advance for any help.
error C2352: 'Person::getCount' : illegal call of non-static member
function
Here is my getCount function declaration:
-----------------------------------------------------------------------------------
//person.h
class Person
{
....
public:
...
int getCount();
}
----------------------------------------------------------------------------------
//person.cpp
int Person::getCount()
{
return count;
}
----------------------------------------------------------------------------------
//test.cpp
int main()
{
....
for (int i = 0; i < Person::getCount(); i++)
persPtr->print();
int total = Person::getCount();
....
}
-----------------------------------------------------------------------------------
Do you see something that I don't? Mind I'm a bit of a beginner with C+
+. I've spent far too long trying to figure this one out.
Thanks in advance for any help.