Home > Back-end >  C programming topics explain purpose especially the meaning of the scarlet letter part
C programming topics explain purpose especially the meaning of the scarlet letter part

Time:09-28

#include
using namespace std;
Class A {
int a,b;
Public:
(A) {A=0; b=0; }
Void the set (int t) {a=t; B=2 * t; }
Friend void show (A *);
};
Void show (A * t) {cout< (t - & gt; A + t - & gt; B) & lt; Int main ()
{
Int t=1;
A a1 [5], * pa=a1;
For (int I=1; i<4. I++)
(pa + I) - & gt; Set (t +=1);
Pa=a1;
While (pa<=& amp; A1 [4]) {
Show (pa);
Pa++;
}
return 0;
}

CodePudding user response:

This,,,, too basic
1 is a pointer to access the member variable
2 is a pointer to invoke a member function

CodePudding user response:

(t - & gt; A + t - & gt; B) 1 is a pointer to access the member variable
2 is a pointer to member function called

Pa + I pa the ith a's object in the array
  • Related