Tag: 不完全类型的

数据隐藏在C ++中

我在C中有一些代码,它以这种方式使用不完整的结构(简化示例): something.h struct something; struct something *new_something(); int work_a(struct something *something); int work_b(struct something *something, const char *str); void free_something(struct something *something); somecode.c int some_function() { struct something *something; int x; something = new_something(); x = work_a(something); free_something(something); return x; } 我在想,我基本上是在做C ++,为什么不尝试用C ++编写。 问题是(我是C ++的新手),我如何在C ++中实现相同的目标? 如果我尝试添加声明一个不完整类的成员函数,我得到 error: incomplete type ‘something’ named in nested […]