除关键字不同外(class,struct)的唯一区别是,结构在默认情况下的成员是公共的,而类在默认情况下的成员是私有的。
c中不能,c++里可以在结构体内定义函数,用法和class定义类是一样的。structs are often used to hold small sets of data, whereas classes are more often used when there are methods
除关键字不同外(class,struct)的唯一区别是,结构在默认情况下的成员是公共的,而类在默认情况下的成员是私有的。
c中不能,c++里可以在结构体内定义函数,用法和class定义类是一样的。structs are often used to hold small sets of data, whereas classes are more often used when there are methods