Hello! I am new to C++ and I am coding my first programs but I have a couple problems here (though very basic, I guess).
I just want to define a class and its setters and getters methods but I am doing something wrong about the class members accessibility. In this case, I want to make a line which is defined by a group of Squares
Line.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include "Square.h"
#include <vector>
class Line
{
public:
typedef std::vector<Square> vSquare;
Line(void);
~Line(void);
vSquare getBody();
void setBody(vSquare);
private:
vSquare Body;
In the definition of methods getBody and setBody, the compiler tells me that Body is inaccessible. I know that I declared it in the private section but all the examples I have read, there was no problem with this. If I write only Body instead of Line::Body, it doesn't recognize variable Body.