Acces aux attributs privés
Bonjour,
J'ai une erreur au niveau d'acces aux attributs privé
voilà mon code
A.hpp
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
#include <stdlib.h>
#include <iostream>
class A
{
private:
int x,y;
public:
A(int a,int b):x(a),y(b){}
int getX() const{ return x;}
int getY() const{ return y;}
bool operator<(A&,A&);
}; |
main.cpp
Code:
1 2 3 4 5 6 7
| #include "A.hpp"
int main()
{
A a1(1,2);
return 0;
} |
J'ai une erreur au niveau du constructeur
A.hpp:9: error: ‘A::A(int, int)’ is private
main.cpp:7: error: within this context
Merci