Mail Archives: djgpp/1998/01/24/17:50:46
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 -