Re: Base class and OOP in C
From: jonathon (j_mckitrick_at_bigfoot.com)
Date: 03/30/05
- Next message: collinm: "Re: Problem to read on a serial port"
- Previous message: James Antill: "Re: pointers to stack and -03"
- In reply to: Måns Rullgård: "Re: Base class and OOP in C"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 30 Mar 2005 11:19:21 -0800
> If you change your declarations slightly, it will work:
>
> typedef struct base {
> whatever;
> } base_t;
>
> typedef struct foo {
> base_t base; /* not a pointer */
> foo_additions;
> } foo_t;
---- <snip> ----
> Now, a pointer to any of these, will be valid as a base_t *.
The only catch is you have to have a definition of base_t for any
derived class. I was hoping to be able to hide the details of this
structure by using a pointer which can be resolved later.
- Next message: collinm: "Re: Problem to read on a serial port"
- Previous message: James Antill: "Re: pointers to stack and -03"
- In reply to: Måns Rullgård: "Re: Base class and OOP in C"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|