Why is this happening?
Ok. Whenever I run the program it displays
Leo is a dog who is -856993460 and weighs -858993460 pounds. Wtf /
[PHP]#include <general.h>
class Dog
{
public:
int GetAge();
void SetAge(int age);
int GetWeight();
void SetWeight(int weight);
void Bark();
private:
int itsAge;
int itsWeight;
string itsName;
};
int Dog::GetAge()
{
return itsAge;
}
int Dog::GetWeight()
{
return itsWeight;
}
void Dog::SetAge(int age)
{
age = itsAge;
}
void Dog::SetWeight(int weight)
{
weight = itsAge;
}
void Bark()
{
cout << "Bark\n";
}
int main()
{
//Create Dog
Dog Leo;
//Set Dog age
Leo.SetAge(1);
//Set Dog weight
Leo.SetWeight(6);
cout << "Leo is a dog who is " << Leo.GetAge() << " Years old. And weighs " << Leo.GetWeight() << " Pounds\n";
return 0;
}
[/PHP]
Leo is a dog who is -856993460 and weighs -858993460 pounds. Wtf /

[PHP]#include <general.h>
class Dog
{
public:
int GetAge();
void SetAge(int age);
int GetWeight();
void SetWeight(int weight);
void Bark();
private:
int itsAge;
int itsWeight;
string itsName;
};
int Dog::GetAge()
{
return itsAge;
}
int Dog::GetWeight()
{
return itsWeight;
}
void Dog::SetAge(int age)
{
age = itsAge;
}
void Dog::SetWeight(int weight)
{
weight = itsAge;
}
void Bark()
{
cout << "Bark\n";
}
int main()
{
//Create Dog
Dog Leo;
//Set Dog age
Leo.SetAge(1);
//Set Dog weight
Leo.SetWeight(6);
cout << "Leo is a dog who is " << Leo.GetAge() << " Years old. And weighs " << Leo.GetWeight() << " Pounds\n";
return 0;
}
[/PHP]




