比如:
struct Node
{
int data;
struct Node * next;
};
去掉struct Node *next中的struct呢?
如果节点是class定义的就不需要加class了,为什么?
追答C++编译器一般没有这个约束,C里面会有的。
如果节点是class定义的就不需要加class了,为什么?
追答class 本来定义一个对象就不用添加class 关键字.
你写C语言,也完全可以用C++编译
struct student{
int data;
student * next;
};
g++ test.c -o a.bin
一样可以的。但用C编译器就不行。