tags:

views:

144

answers:

4

Was class evolve from structures?

+7  A: 

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".

John Saunders
[citation needed]
Greg Hewgill
http://en.wikipedia.org/wiki/Simula-67 confirms this.
Potatoswatter
+1 for being so geeky that you knew that.
George
I meant [citation needed] for the assertion that "class" is derived from a Swedish word.
Greg Hewgill
@Greg: Yes, I'd really want to see this citation. A class does nothing but describe a class of objects that can be created from its definition. Class is therefore a proper English word somewhat related to "category".
Dario
@Peter: Simula was my language of choice "back in the day". It had all the advantages of ALGOL-60, plus this interesting "class" concept they introduced to make discrete simulations easier. Believe me when I tell you that a discrete simulation is easier if you're simulating _objects_.
John Saunders
@Dario: a citation would be nice, but consider that the work on Simula was done at http://en.wikipedia.org/wiki/Norwegian_Computing_Center - English may not be relevant.
John Saunders
Dubious; they apparently wrote their papers in English there: "Dahl O.-J., and Nygaard K: 'Class and subclass declarations'. NCC Document, March 1967. " Besides, they don't speak Swedish in Norway.
MSalters
@MSalters: Swedish, Norwegian, whatever, I remember that it was not an English word. In order to find a counter-argument, find an earlier use of "class" to mean something like what "type" means in colloquial English - a set of characteristics held in common by members of some other set.
John Saunders
@John: "class" comes from the Latin _classis_, when it applied solely to people. However, _class_ / _classification_ / _to classify_ in the modern sense dates back to the 18th century.
MSalters
A: 

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.

Gabriel Ščerbák
Neither C With Classes nor C++ were implemented as macro libraries. Both were implemented as pre-processors, which emitted C, which was then compiled.
anon
I always thought pre-processor processes macros and therefore pre-processor has to consist of some sort of macro library.
Gabriel Ščerbák
+2  A: 

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.

Greg Hewgill
why did he require to make CLASS compatible with existing C structure.
coming out of void
Because there's value in uniform syntax. Less stuff for people to learn. Unions employ a similar syntax, too.
Seva Alekseyev
smerlin
A: 

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...

Robin Welch