set get clarification

I am just starting object-orientated programming and
this topic is giving me some problems.
Can someone explain to me where the connection is between set and set functions.

lets say
class name
public:
name(string);
void setX();
int getX();

I am not sure where to use the functions: the implementation file or the .cpp file containing int main().

Thanks for any help
Generally, class definitions and method/function declarations are done in headers, while the implementation goes in the source (cpp) files.

The point of get/set methods is for encapsulation of a class.
Last edited on
Topic archived. No new replies allowed.