Are pointers to pointers legal in c++? I've come across this SO question: Pointer to Pointer to Pointer
But the answers aren't clear if it is legal c++ or not. Let's say I have:
class A{
public:
void foo(){
/* ect */
}
};
class B{
public:
A* a;
/* ect */
};
void Some_Func() {
B *b;
// besides this looking ugly, is it legal c++?
b->a->foo();
};
Is the line b->a->foo() OK to write? Is there a better way to represent this expression?
fooandaare private in each of their classes (you'd have to make them public for this to work), why should it not be ok? It's not even particularly ugly, actually.