I'll say it again:

> OO *design* is a far older concept than C++ 
     --------

How's about this:

typedef enum _ObjectTypes
{
        eBase,
        eDerived
} EObjectType;

typedef struct _BaseObjectType
{
        int m_baseObjectMember;
} BaseObject;

typedef struct _DerivedObjecType
{
        BaseObject baseObject;
        int m_derivedObjectMember;
} DerivedObject;

typedef struct tagObject
{
        EObjectType m_myType;
        union
        {
                base BaseObject;
                derived DerivedObject;
        }
} Object;


This is a C implementation of an Object Oriented Design which involves
inheritance.

> I know, because I tried--before I ever heard of OOP or C++. :)
How did you try to write OOP code in C before you heard of OOP?     &8-|

Cheers,
        Idries

-----Original Message-----
From: Mark Wilden [mailto:[EMAIL PROTECTED]]
Sent: 04 October 2002 17:59
To: Palm Developer Forum
Subject: Re: C or C++


----- Original Message -----
From: "Idries Hamadi" <[EMAIL PROTECTED]>

> OO design is a far older concept than C++ and there is no reason not to
use it in a straight C

(I know this is off-list, so I'll keep it short.:)

A couple of folks have talked of writing OOP in C, and I'm here to say that
it can't be done. :) You can write object-_based_ code in C (as in VB), but
without compiler support for inheritance, you can't be said to be writing
object-oriented code.

I know, because I tried--before I ever heard of OOP or C++. :)


-- 
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to