comp.lang.ada
 help / color / mirror / Atom feed
* Classes vs. Types, do they differ ??
@ 1992-04-29  8:17 Jan Erik Sevland
  0 siblings, 0 replies; only message in thread
From: Jan Erik Sevland @ 1992-04-29  8:17 UTC (permalink / raw)


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                     
|

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1992-04-29  8:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1992-04-29  8:17 Classes vs. Types, do they differ ?? Jan Erik Sevland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox