【发布时间】:2022-05-09 20:39:18
【问题描述】:
I am analyzing some codes in c++ and I came across this configuration.
class jack {
//rest of the class body here
public:
jack *a;
};
What is the theory of using a pointer in that configuration?
【问题讨论】:
-
See linked lists in C++.
-
What do you mean by what is the theory? That pointer could point to an instance of
jack. Why someone would need that is impossible to answer without more information. -
It works because at the time you declare the pointer inside the class/struct, you do not need the complete type, you only need to know the name. There is probably some fancy name for this that somebody else will point out.
标签: c++