A general term of classes and structs?

I understand that structs are very similar to classes, only member access and inheritance defaults to public. Conventionally, they're used as POD types, but, again, that's just a convention.

Despite the small differences (and the differences in the convention of using them), it's clear that classes and structs are both just slightly different interpretations of something, where that something defines the behavior of a set of objects. What's that something?

I know that's how classes are usually defined, but structs fit the definition too, and, at least in C++, structs mean something slightly different than a class. Or would you simply distinguish between a class (as a concept) and C++ classes (which, along with C++ structs, would be a specific implementation / approach to the class concept)?


Types declared using class and struct are collectively referred to as "non-union classes" by the C++ standard. As for their common behaviour... well, you obviously know what that is already.

链接地址: http://www.djcxy.com/p/94578.html

上一篇: 用const成员方法导出类

下一篇: 类和结构的总称?