C语言的struct不能有函数成员,而C++的struct可以有;
C语言的struct中数据成员没有private、public和protected访问权限的设定,而C++的struct的成员有访问权限设定;
C语言中的struct是没有继承关系的,而C++的struct却有丰富的继承关系
From:小肥羊的慢慢科研路
//C语言中:
struct Student{
int a;
int b;
};
int main(){
struct Student st;//必须含有struct
}
//C++语言中:
struct Student{
int a;
int b;
};
int main(){
Student st;//不必含有struct
}