c++ - 在 C++ 中访问指向指针的指针

标签 c++ pointers function-pointers

您好,我在我的 iPhone 应用程序中使用第 3 方库,它使用 C++ 我需要使用的方法之一返回指向类指针的指针。如下所示。

DLL classAttributes** getAttributes();

我可以成功调用该方法并将值返回到指向这样的指针的指针中;

classAttributes **attributes = cPPClass->getAttributes();

但是我似乎无法访问该类的任何方法,例如我知道该类有一个名为 getName() 的函数;但是当我尝试调用它时出现错误。

attributes->getName(); 'Request for member 'getName' in *attributes'; which is of non-class type 'attributes*''

我做了一些谷歌搜索,发现一些东西说访问指针指针地址使用格式

&(*attributes)->getName(); 'invalid uses of incomplete type 'struct attributes'

任何帮助将不胜感激。 谢谢。

最佳答案

'invalid uses of incomplete type 'struct attributes' 表示您需要为它#include 头文件。它仅在此时在您的代码中进行前向声明。

关于c++ - 在 C++ 中访问指向指针的指针,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3826481/

相关文章:

c++ - C和C++不完全数组指针转换规则的区别

c++ - 无法调用指针的打印函数

c++ - static constexpr 指向函数的指针,编译器之间的区别

c++ - 使用 C++ Stream API 发生访问冲突异常

c++ - 返回类型而不是对象如何有效,误解了代码片段

c++ - C++ 类中的任意数据类型

c++ - Qt - 在其他线程上运行函数

c++ - C++ 中的二叉搜索树,叶子为空值,不使用引用参数

c++ - 指向成员函数的函数指针

c++ - 从成员函数模板化参数调用成员函数