I am getting a little confused over classes. Take this code for example.
Is GetAge() and SetAge() called accessor functions? And is dogAge a data member?Code:#include <iostream>
using std::cout;
class dog
{
public:
void GetAge() { cout << dogAge; }
void SetAge(int age) { dogAge = age; }
private:
int dogAge;
};
int main()
{
dog Spot;
Spot.SetAge(5);
Spot.GetAge();
return 0;
}
EDIT: Had a little error in it, but it is fixed now.