Base class and OOP in C

j_mckitrick_at_bigfoot.com
Date: 03/29/05


Date: 29 Mar 2005 05:44:14 -0800

Hi all,

I am trying to implement some C++ functionality in C.

Suppose I have several libraries that share behavior and properties,
such as
version, working directory, and so on. I want other libraries to
extend
this behavior without having to duplicate any code. For instance:

typedef struct base
{
        char version[32];
        char path[32];
} base_t;

typedef struct foo
{
        base_t *base;
        int data;
} foo_t;

typedef struct bar
{
        base_t *base;
        int data;
} bar_t;

lib-base.so:
        base_get_version(base_t *, char *);
        base_get_path(base_t *, char *);

lib-derived-foo.so:
        foo_one_method(foo_t *, int data);
        foo_two_method(foo_t *, int data);

lib-derived-bar.so:
        bar_one_method(bar_t *, int data);
        bar_two_method(bar_t *, int data);

I want the derived modules to link with the base library, so that my
application can link with only the derived modules and still be able to
call
the base functions without having to link to that library or call
'wrapper'
functions in the derived modules.

Is there a way to do this?



Relevant Pages

  • Re: use of backward single quote in procedure names, was: DST (summer time) offset
    ... char *dlistFile; ... thing that gets you beyond the standard C libraries. ... topic (RISC OS group, RISC OS language discussion) and I'll bother to ...
    (comp.sys.acorn.programmer)
  • Re: Base class and OOP in C
    ... > Suppose I have several libraries that share behavior and properties, ... > typedef struct base ... > I want the derived modules to link with the base library, ...
    (comp.lang.c)
  • Re: Base class and OOP in C
    ... > Suppose I have several libraries that share behavior and properties, ... > typedef struct base ... > I want the derived modules to link with the base library, ...
    (comp.unix.programmer)
  • Base class and OOP in C
    ... Suppose I have several libraries that share behavior and properties, ... version, working directory, and so on. ... typedef struct base ... I want the derived modules to link with the base library, ...
    (comp.lang.c)
  • Re: Newbie: module structure and import question
    ... > i have question on how to design a module structure. ... which makes python search the current working directory. ... and your libraries and modules. ... I'm not exactly clear what your asking -- but I think yor asking if you'd ...
    (comp.lang.python)