Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!elroy.jpl.nasa.gov!sdd.hp.com!mips!daver!tscs!tct!chip From: chip@tct.uucp (Chip Salzenberg) Newsgroups: comp.std.c++ Subject: Re: type/member tags (was Re: asking an object for its type) Message-ID: <27D26F2C.2D99@tct.uucp> Date: 4 Mar 91 16:00:44 GMT References: <1991Feb27.154311.782@csc.ti.com> <27CD159D.6581@tct.uucp> <1991Mar3.004313.17674@gpu.utcs.utoronto.ca> Organization: Teltronics/TCT, Sarasota, FL Lines: 25 According to craig@gpu.utcs.utoronto.ca (Craig Hubley): >In article <27CD159D.6581@tct.uucp> chip@tct.uucp (Chip Salzenberg) writes: >>Is there any reason to avoid virtual functions for object storage? > >The need to derive all "storable" types from a given base. Among other >problems, you can't store an int or a char* that way. I wouldn't expect an OODB to be able to store a |char *|, since it has no way to know what it's pointing at and/or who "owns" it. >>I had not envisioned a virtual function to return type information, >>but rather a virtual function to actually _do_the_work_, so no one >>outside of that function need know the actual type of the object >>stored. > >This works so long as you are prepared to write a new function for each >storable type. This is not what I expect from an OODB. Surely you would in practice distinguish between "some entity needs to write it" and "_I_ need to write it". Any OODB worth the floppy it's distributed on would generate such a function automatically. -- Chip Salzenberg at Teltronics/TCT , "All this is conjecture of course, since I *only* post in the nude. Nothing comes between me and my t.b. Nothing." -- Bill Coderre