TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: Herbert Bushong
from: Neil Heller
date: 2003-01-08 16:11:00
subject: Declaring a pointer to a

HB> try this:

HB> ::>      class a_class
HB> ::>      {
HB> ::>           // some stuff
HB> ::>      };

HB> typedef class a_class* a_classptr;

HB> ::>      class b_class
HB> ::>      {
HB> ::>           a_class * pa_class;     // the first error... why ?
HB> change to:

HB> a_classptr pa_class;

I did a slight variation on this but it was wrong.  Can you tell me why?

In file a.h, just below a_class I did

typedef a_class * pa_class;

Then, in class_b I did:

pa_class  m_paclass;

This resulted in 2 errors:

a_classptr: missing decl-specifiers
syntax error: missing ';' before '*'

I am still off... somewhere... but can't figure it out.


HB> or alternatively:

HB> class a_class * pa_class;

HB> ::>           // some other stuff
HB> ::>           public:  b_class(int, a_class *);
HB> ::>      }

HB> might work.

Maybe, but I think that the first style is cleaner.

þ CMPQwk 1.42 999

--- Maximus/2 3.01
* Origin: COMM Port OS/2 juge.com 204.89.247.1 (281) 980-9671 (1:106/2000)
SEEN-BY: 633/267 270
@PATH: 106/2000 1 379/1 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.