recalling an object within its class

I am trying to write a class that will run functions on the specific object from within that class. I am not sure what this type of operation is called. example:
1
2
3
4
5
6
7
//snake.h
class snake
{
public:
void setAge(int a) {_a=a;}
int getLength();
}

1
2
3
4
5
6
7
8
//snake.cpp
int snake::getLength()
{
int age;
cin<<age;
SNAKE.setAge(age);
return age*3;
}

where SNAKE would be whatever object you run getLength() on.
A member function? Or possibly a mutator function?
setAge( age );

Topic archived. No new replies allowed.