Article View: comp.std.c++
Article #2665Re: Virtual static members
From: law
Date: Mon, 20 Nov 1995 16:34
Date: Mon, 20 Nov 1995 16:34
41 lines
2737 bytes
2737 bytes
In <488hg6$prm@engnews1.eng.sun.com>, clamage@Eng.Sun.COM (Steve Clamage) writes: >Virtual things are associated with an object; static things are not >associated with any object. I think maybe you need to "think outside the box" a bit more :-). The whole issue is whether such a restrictive viewpoint is appropriate. A reasonable point of view is that virtual and static are completely orthogonal and intersect quite nicely. Virtual things depend on the actual type of the referenced object. Static things are associated with the class of an object rather than with a specific instance. Ergo, static virtual things depend on the actual class of the referenced object, rather than the static type of the expression by which you reference it. >That's workable, if a bit kludgy, but it isn't obvious to me (among others) >what programming problem is solved by this extra complication that can't be >solved adequately already. I won't try to defend virtual data members, but static virtual functions solve the problem of safely invoking derived class code from within base class constructors and destructors (a programming problem which can't be solved adequately already). >By that, I don't mean "Can you think of a problem >that this extension solves?" I do mean "Considering the criteria expressed in >D&E and other places for extensions to C++, is this a good candidate?" No. I say that because one of those "other places" is here and clearly the criteria expressed implicitly during discussion of this issue indicates that the value of static virtual functions is too subtle to be appreciated, I guess. That's cool. I can't appreciate the subtle value in having all my for loops being broken. I do, however, acknowledge the arguments in favor of doing that. >--- >Steve Clamage, stephen.clamage@eng.sun.com Bill Law [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu. Contact address: std-c++-request@ncar.ucar.edu. The moderation policy is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<48ptrj$t7i@shellx.best.com>Path:
arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamageReferences:
<487q1e$peq@aztec.co.za> <488hg6$prm@engnews1.eng.sun.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage From: law@solution-frameworks.com Newsgroups: comp.std.c++ Subject: Re: Virtual static members Date: 20 Nov 1995 16:34:54 GMT Organization: Solution Frameworks, San Jose CA Approved: clamage@eng.sun.com (comp.std.c++) Message-ID: <48ptrj$t7i@shellx.best.com> References: <487q1e$peq@aztec.co.za> <488hg6$prm@engnews1.eng.sun.com> Reply-To: law@solution-frameworks.com (Bill Law) NNTP-Posting-Host: taumet.eng.sun.com Content-Type: text X-Nntp-Posting-Host: lawman.vip.best.com X-Newsreader: IBM NewsReader/2 v1.2 Content-Length: 1844 X-Lines: 37 Originator: clamage@taumet