开发者

Evolution of Class

Was class evol开发者_如何学Cve from structures?


No. The "Class" concept was introduced in the Simula-67 programming language. I gather that the word "class" (or is it "classe") is Swedish for "type".


The original name for C++ was "C with Classes". One of the design goals of C++ (for better or worse) was that a high degree of compatibility with C was retained. It was natural in that environment to make a class exactly the same as a struct with the addition of a concept of a "method".

Bjarne Stroustrup's book The Design and Evolution of C++ has a lot more information on the history of C++. Highly recommended if you're interested in the topic.


C++ evolved from C, firstly as a macro library, at least that I read in some interview with Bjarne Stroustrup(creator of C++), so I guess you are right.


In C++ a class and a struct are essentially the same with one key difference: the access is inverted so that by default all access to a struct is public just the same as it is in C, whereas a class is private by default.

That wasn't your question though was it? Ho hum...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜