[3435] in java-interest

home help back first fref pref prev next nref lref last post

Re: declaration v.s. definition ambiguity

daemon@ATHENA.MIT.EDU (Michael Daconta)
Sun Nov 12 11:43:02 1995

Date: Sun, 12 Nov 1995 07:32:44 -0700 (MST)
To: garya@village.org (Gary Aitken), java-interest@java.sun.com
From: daconta@PrimeNet.Com (Michael Daconta)

At 07:27 PM 11/11/95 -0700, Gary Aitken wrote:
>>Java seems to have done away with declarations all together and
>>just uses definitions.  
>
>I don't think this is quite correct, or else I don't understand what
>you mean by definition.
>The members of a class are declared, with no storage allocation
>implied unless they are declared static.
>The methods are defined, since the announcement of their signature is
>required to be accompanied by the definition of the semantics which
>implements them.  Exception: abstract methods, which are a pure
>declaration, and cannot include any semantics (unfortunately).
>If you also consider interfaces, interfaces are pure declarations,
>and have no storage reservation associated with them anywhere, unless 
>you consider the implicit storage reservation which occurs
>when they are implemented in a class.
>
>Gary Aitken		garya@village.org
>
>

Hi Gary!

Thanks for responding.  

You seem to be thinking of declaration vs definition as it is used in
ANSI C whereby declaration announces to the compiler the identifier and
type and whereby definition is both the announcing to the compiler and
the reservation of storage space.

It seems that this is now changing in C++.

The most simplest way to phrase the question is this:

what do you call this:

class myObject {
        int a;

        myObject()
        {
                a = 0;
        }

        // other methods

}

Is it a class declaration  OR
      a class definition.

If you go by ANSI C:  class declaration (even though there are no classes)
          by C++:  class definition
          by Java: class definition????

 - Mike

-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post