From: RAGHU on
Hi all,

I am new to MFC

My question is why is CARCHIVE class not derived from COBJECT class

I am not able to find satisfying answer from blogs

Please explain on this

TIA,
RAGHU
From: Giovanni Dicanio on
[added microsoft.public.vc.mfc]


"RAGHU" <raghudr(a)gmail.com> ha scritto nel messaggio
news:6af3f447-c3d3-4e37-a13d-b1f79795bf14(a)b2g2000yqi.googlegroups.com...

> I am new to MFC

You may want to consider microsoft.public.vc.mfc newsgroup for MFC
questions.


> My question is why is CARCHIVE class not derived from COBJECT class

There are several classes in MFC that are not derived from CObject, as you
can read from the following diagram:

http://msdn.microsoft.com/en-us/library/ws8s10w4(VS.80).aspx

Classes like CArchive (or CDumpContext) are kind of "helper classes" for
CObject: they are *used* by CObject for some features like e.g.
serialization (CArchive), or run-time type information (CRuntimeClass), etc.

When you have an hineritance relation, you may think of it as a "Is-A" kind
of relation. So, if CArchive had been derived from CObject, it would have
meant something like "CArchive *Is-A* CObject". But this does not reflect
the nature of CArchive, which is not a CObject, but is just an *helper class
used by* CObject. CArchive is a "tool" that CObject uses to offer some
features (like serialization support).

HTH,
Giovanni