C ++ is new here.
I am a science guy writing cfd (ish) code. I created a class for all crucial functions, and another for operations with a grid. The grid class wants to see some of the variables stored in the decisive class, because passing them all to the grid class seems a bit stressful.
So, in my research, I came across friend classes, but I can't get it to work. See the example below. Class A is the solver, and it creates a grid class B. Even if I wrote a friend's class B, I still get the following compilation error (g ++):
In the member function 'void B :: testB ()':
error: 'a1' was not declared in this area
Here is the code:
source share