🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Mark Johnson Thu, 31 Dec 1992 20:25
Comparison?
#18
Author: Mark Johnson
Date: Thu, 31 Dec 1992 20:25
4 lines
498 bytes
What are the main differences in the approach toward objects
between CLU and G++ ?
 
Thank you, MJ
Re: Comparison?
#20
Author: Andrew Myers
Date: Mon, 04 Jan 1993 19:45
35 lines
2125 bytes
In article <9212311409.AA27039@netcom.netcom.com> mjohnson@netcom.com (Mark Johnson) writes:

   What are the main differences in the approach toward objects
   between CLU and G++ ?

   Thank you, MJ


There are many differences between the concepts of objects in CLU
and C++ (G++ doesn't differ from C++ in this respect). Off the top
of my head:

1. CLU objects are always allocated on the heap, whereas C++ objects
   may be stack-allocated. As a byproduct of this, C++ has the types
   "T &" and "T *" for (most) any type "T".
2. CLU objects are garbage-collected. C++ objects must be explicitly
   deallocated.
3. C++ has subtyping on pointer and reference types, and inheritance.
   CLU has no subtyping, though its abstraction mechanism does share
   the identity-preserving aspect of the usual inheritance mechanisms.
4. CLU's parameterized types are more powerful, since
   they can be used like functions to generate new types. Typechecking
   of C++ templates is done at instantiation time, but CLU parameterized
   clusters can be typechecked before instantiation because of the
   "where" clauses.
5. The CLU methodology of abstraction only allows type operations to
   be visible from the outside. C++ allows fields (member variables)
   to be visible as well. C++ class declarations are forced to mention
   all members of the type, even if they are private. CLU declarations
   can only mention public operations.
6. Variables in CLU are pointers to objects, and assignment is a special
   statement form. Variables in C++ are containers for objects, and
   assignment is a member function (method).

Andrew
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads