I just don't get it, what is wrong in this friend declaration, first error msg:
test.cpp: In function 'int main()':
test.cpp:34:7: error: 'void steuerung::exe_testa(testa)' is private
test.cpp:48:15: error: within this context
The problem is being solved, when the constructor in testa's class declaration is removed. But I need a constructor. Can anyone please help me? Really thank YOU.
#include <iostream>
class steuerung;
class testb;
class testa;
class testa
{
friend class steuerung;
public:
private:
double a_;
double b_;
};
class testb
{
friend class steuerung;
public:
testb(double a, double b) : a_(a), b_(b) {}
private:
double a_;
double b_;
};
class steuerung
{
friend class testa;
friend class testb;
void exe_testa(testa t_) { t_.b_++; }
//template<class t> void exe(t *t_) { std::cout << t_->a_ << std::endl; }
};
int main ()
{
std::cout << "Laeuft zumindest an.." << std::endl;
testa a;
steuerung s;
s.exe_testa(a);
return 0;
}