Structures

Jorgen Grahn grahn+nntp at snipabacken.se
Mon Nov 3 16:55:16 EST 2008


On Mon, 3 Nov 2008 20:33:45 +0000, Paulo J. Matos <pocmatos at gmail.com> wrote:
> On Mon, Nov 3, 2008 at 12:32 PM, Ben Finney
> <bignose+hates-spam at benfinney.id.au> wrote:
>> "Paulo J. Matos" <pocmatos at gmail.com> writes:
...
>> I'm wondering a more fundamental question: What are structures? That
>> is, what do *you* mean by that term; without knowing that, an answer
>> isn't likely to be meaningful.
>>
>>> [?] structures are something like classes with only public methods
>>
>> Care to say more about what they are, not what they're like?
>
> Well, I guess that everyone pretty much gets since it exists in every
> other language as struct, or define-structure, or whatever is the
> syntax.

You're right.  But the explanation you gave above, "classes with only
public methods", is C++-specific, and also fairly misleading ... there
is no real difference in C++ between struct Foo {}; and a class Foo
{}; it's just shorthand for class Foo { public: }; and struct Foo {
private: }; respectively.

/Jorgen

-- 
  // Jorgen Grahn <grahn@        Ph'nglui mglw'nafh Cthulhu
\X/     snipabacken.se>          R'lyeh wgah'nagl fhtagn!



More information about the Python-list mailing list