I looked through many different examples and explanations, but no one answered what I was looking for. I have three classes with the connect method for each of them:
class foo { ... }
void foo::connect(bar br) { ... }
class bar { ... }
bar& bar::connect(baz bz) { ... }
class baz { ... }
baz& baz::connect() { ... }
In my main class, I plug them in as follows:
foo.connect(bar);
bar.connect(baz);
baz.connect();
or
foo.connect( bar.connect( baz.connect() ) );
(I know this is briefly explained, I can explain it better if necessary)
So, I tried to overload the "→" operator to have something like this in the main function:
foo >> bar >> baz;
It works for the first statement, so if I just do the following, it works fine:
foo >> bar.connect(baz.connect);
But, when I set another operator "→", g ++ returns this error:
error: no match for ‘operator>>’ in ‘operator>>((* & foo), (* & bar)) >> baz.baz::connect()’
I think that I am not overloading the "→" operator correctly:
bar& operator>> (bar &br, baz &bz)
{
...
}
Thanks for the help:)