delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/09/13:51:36

Message-Id: <361E4CE8.A626C0D9@cableol.co.uk>
Date: Fri, 09 Oct 1998 18:50:32 +0100
From: The Allens <allen DOT asjp AT cableol DOT co DOT uk>
X-Mailer: Mozilla 4.04 [en] (Win95; I)
Mime-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: structures
References: <19981009010858 DOT 09176 DOT 00008713 AT ng141 DOT aol DOT com>
Reply-To: djgpp AT delorie DOT com

You can't put functions inside structs in c, but you can put them inside
classes in c++.  I think the function is called class, but I don't do
c++ so I can't be sure.  Apart from replacing struct with class, it
looks ok.

		Peter Allen

Twidler wrote:
> 
> Does DJGPP support structures.  How about procedures in structures?
> 
> I tried this in DJGPP:
> 
> typedef struct NICEDOGY
>     {
>     int x, y;
>     int w h;
> 
>     int Draw_It()
>         {
>         x=w;
>         y=h;
>         }
>     }NICEDOGY;
> 
> and it didnt work...it gave me some errors at the Draw_It() procedure.
> what is going on here?  How do I fix this without putting the Draw_It()
> procedure outside of the structure?
> 
> Twidler

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019