I have the main class "arm", it has many attributes like long or elbow, but it has as an attribute one object of the class "hand". Hand has different methods and attributes so it´s important to make it as a different class.
My question is how to use an object as an attribute of another class on c++? (i´m using Microsoft Visual Studio)
the class hand is
on hand.h
class hand
{
private:
int number_of_fingers;
public:
void handleSomthing();
}
and the class arm is
on arm.h
#include "hand.h"
class arm
{
private:
float long;
int elbow;
hand right;
}
But when I include "hand.h" on arm an error occurs saying
error C2011: 'hand': new definition of type 'class'
If I try to use hand.h and create and use objects on the main program it works, so the problem is not on the class hand I think.
I´m trying to learn OOP and I´ll really appreciate your help