//File example of classes (to benefit from the this pointer =D
#include <string>
#include <iostream>
usingnamespace std;
//declare class dog
class dog
{
//private
private:
int age, weight;
string color;
public:
void bark(){
cout << "WOOF!" << endl;}
//setter methods
void setvalues(int age, int weight, string color){
//this is used when a class method has an argument of the same name as a class member.
this-> age = age;
this-> weight = weight;
this-> color = color;}
//getter
int getAge() {return age;}
int getWeight() {return weight;}
string getColor() {return color;}
};
int main()
{
dog fido;
fido.setvalues(3,15,"brown");
dog pooch;
pooch.setvalues(4,18,"gray");
cout << "fido is a " << fido.getColor() << " dog " << endl;
cout << " he is " << fido.getAge() << " years old" << endl;
cout << "Fido weights " << fido.getWeight() << endl;
fido.bark();
cout << "Pooch is a " << pooch.getColor() << " dog " << endl;
cout << " he is " << pooch.getAge() << " years old" << endl;
cout << "Fido weights " << pooch.getWeight() << endl;
pooch.bark();
}