OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: XML Schema equivClass.

[ Lists Home | Date Index | Thread Index ]
  • From: Steve Harris <sharris@primus.com>
  • To: xml-dev@xml.org
  • Date: 03 Feb 2000 08:27:58 -0800

Stefan Haustein <haustein@kimo.cs.uni-dortmund.de> writes:

[...]

> BTW, a similar problem exists in C++:
> 
> consider class A, class B extends A
> 
> you cannot assign an instance of B to an A variable because it may
> consume more memory and thus not fit...

If B extends A, then A was probably not designed to accept assignment
from the then-unknown type B. You can slice B to cram it into A, but
of course you shouldn't. I'm not sure of any scenario where you would
want to assign a concrete B to a concrete A.

> So you need explicit pointers to make really use of inheritance.

Or references. It's only a matter of writing the proper function signatures.

> But with pointers, you cannot really use the STL (no wonder if you
> read what the STL author thinks of OOP). So you also need some
> wrapper classes....

We use the Standard C++ containers with pointers all the time. You can
take a container of A*'s, put your A*'s and B*'s (and any other types
derived from A) into it, and call polymorphic methods on the elements
using the std::mem_fun* functors.

Stepanov is not out to block active use of OOP; he's just saying that
he doesn't find it to be the panacea most claim it is [1]. There was a
long and healthy discussion about this on comp.lang.c++.moderated in
November 1999 [2].

[1] http://www.cis.umassd.edu/~asanchez/gp/Edizioni-Infomedia.html
[2] http://deja.com/[ST_rn=ps]/viewthread.xp?AN=546022206&search=thread&svcclass=dnyr&ST=PS&CONTEXT=949594960.798294044&HIT_CONTEXT=949594960.798294044&HIT_NUM=24&REDO=1&recnum=%3c806oci$1jn$1@nnrp1.deja.com%3e%231/1&group=comp.lang.c%2b%2b.moderated&frpage=getdoc.xp

-- 
Steven E. Harris
Primus Knowledge Solutions, Inc.
http://www.primus.com




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS