Hello. I am trying to understand a program. In class CGG, there is a definition: CPGE *PGE; I guess it means that PGE is a pointer to class CPGE. Inside the class CPGE, there is a member function called RSFPtr(). Inside class CGG, there is a statement: (*PGE->RSFPtr()) = TempRFState; As far as I understand, PGE->RSFPtr() means calling the member function RSFPtr(). The above statment is different. Could you please let me know what it means?
When I saw your question, what immediate came to my mind is that .. the function RSFptr() must be returning pointer to an array and so the statement (*PGE->RSFPtr()) = TempRFState; assigns TempRFState to the i'th element of that array. Try to run the following test code for further clarification : Code: #include <stdio.h> #define SIZE 1000 class Test { private: int Array[SIZE]; public: int* AccessArray() { return Array; } }; int main() { Test ClassA; Test* pClassA = &ClassA; for(int i = 0; i < SIZE; ++i) (pClassA->AccessArray())[i] = i; for(int i = 0; i < SIZE; ++i) printf("%u\n", (pClassA->AccessArray())[i]); return 0; } There might be some other meaning of (*PGE->RSFPtr()) = TempRFState; If I find any other meaning, I'll update this thread
Thanks for the help. Do you mean the * dereference operator in front of PGE returns to the address of the first element of the array and the moves the pointer to the ith element of the array? When i=0, *PGE just points to the first element of the array?
>> Do you mean the * dereference operator in front of PGE returns to the address of the first element of the array and the moves the pointer to the ith element of the array? When i=0, *PGE just points to the first element of the array? Yes, that's what I meant ! >> Thanks for the help My pleasure !