I'd like to know if there's any way to access a private member of a class from outside the class. I'll explain my problem.
I have a .hpp file which contains the definition of the class along with its private members and public function (which are the only one I'd like to export). In the corrisponding .cpp I have to use some "support" function which need access to the private members of the class defined in the .hpp.
Here's part of my code:
--- .hpp ---
namespace vision {
class CameraAcquisition {
/* MEMBERS */
CvSize size;
CvCapture *device;
CvScalar hsv_min,hsv_min2,hsv_max,hsv_max2;
/* METHODS */
public:
CameraAcquisition();
~CameraAcquisition();
int findBall();
};
}
--- .cpp ---
#include "CameraAcquisition.hpp"
using namespace vision;
IplImage *grabFrame() {
// code here
}
IplImage *convertToHSV(IplImage *origin) {
// code here
}
IplImage *calculateThresholdedImage(IplImage *converted) {
// code here
}
What I need is for these three functions to access the members of the class CameraAcquisition. Is there any way to do it? Any suggestions will be appreciated. Thank you all
EDIT Sorry, I forgot an important piece of information here. In the source file, findBall() must call those methods. I defined those methods to make the code easier to read. I cannot declare those methods in the class definition because I don't want to export them. If I declare them in a "private" block everything works fine, but maybe it's not correct to that (I don't see the point in providing an header file with private methods.