[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XML Schema equivClass.
Stefan Haustein <haustein@k...> 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@n...%3e%231/1&group=comp.lang.c%2b%2b.moderated&frpage=getdoc.xp -- Steven E. Harris Primus Knowledge Solutions, Inc. http://www.primus.com
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|