delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/24/17:50:46

Date: Sat, 24 Jan 1998 13:19:36 -0800 (PST)
Message-Id: <199801242119.NAA03073@adit.ap.net>
Mime-Version: 1.0
To: Mike Coulson <mike AT mcoolie DOT demon DOT co DOT uk>, djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Very simple: What am I doing wrong?

At 08:42  1/23/1998 +0000, Mike Coulson wrote:
>The following code produces errors on my compiler (DJGPP).
>Is this code OK? I have no idea, and am only a beginner.
>I have heard that C++ allows functions to be put into structures. I have
>tried to do this, and get errors.
>
>struct a (
>        int vara;
>        void addone() {
>                vara++;
>                }
>        );
You can't have a source file with only a structure declaration. The
declaration is fine, but it is meaningless by itself. Typically you would
put it in a header file, and include it in any code which wanted to use
`struct a'.

This is a basic C++ question and would be better directed to a comp.lang.c++
newsgroup.

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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