From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.0 required=3.0 tests=BAYES_20 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 29 Apr 92 08:17:02 GMT From: mcsun!sunic2!ugle.unit.no!nuug!ik!jes@uunet.uu.net (Jan Erik Sevland) Subject: Classes vs. Types, do they differ ?? Message-ID: <1992Apr29.081702.28500@inko.no> List-Id: Dear net readers During the last weeks I have had an ongoing discussion with a colleague regarding classes and types. The question is whether they are distinct structures or only variations of each other. Generally we have a common understanding of OOP, since we have studied together, read the same books and used the same languages. Lately I have been involved in an Ada project (using HOOD), while my friend has been using C++ (Note: This is NOT an Ada vs. C++ fight). The discussion began when I started reading Collin Atkinson's brilliant book "Object Oriented Reuse, Concurrency and Distribution". The book describes the DRAGOON language, which is a result of the Esprit project with the same name. Mr. Atkinson makes a clear distinction between "Abstract Data Types" (ADT) and classes, which both are means of implementing "data abstractions". The use of ADTs is called a "value-oriented" approach. ADT's can be implemented in languages which provides incapsulation and restricted access to exported data types (Ada-like languages). Most languages have "ADT's" built into the language itself, like integers ('int') in "C". An 'int' value can only be manipulated by a predefined set of operations. The use of classes, on the other hand, is called an "object-oriented" approach. Where the class "contains" both operations and data types. In C++ this distinction is far from clear. One can infact say that data types are only "classes with no operations". Classes may even inherit types : struct { int a; char b; } A-type; class B-class inherits A-type { ... ... } Both my colleague and I agrees that the syntactical difference between languages is of little importance. But except for the fact that only classes are capable of inheritance, are there any principal difference between types and classes ?? -- _______________________________________________________________________________ _ | Jan Erik Sevland | e-mail : jes@inko.no | snail-mail : | | Software Engineer | tel : +47 2 790660 | P.O Box 265, N-1371 Asker | | InformasjonsKontroll A/S | fax : +47 2 900345 | NORWAY |