Article View: comp.std.c++
Article #2608Re: Virtual static members
From: Etay Bogner
Date: Tue, 14 Nov 1995 16:22
Date: Tue, 14 Nov 1995 16:22
30 lines
1503 bytes
1503 bytes
In article <487q1e$peq@aztec.co.za>, dharley@aztec.co.za (David Harley) wrote:
>> - the idea being, that each subclass of A can posess its own static member
>> that doesn't interfere with other subclasses, but which can be accessed
>> by methods of A.
>>
try :
class Base {
virtual data_type& data() { static data_type BaseData; return BaseData; }
};
class Derived : Base {
virtual data_type& data() { static data_type DerivedData; return
DerivedData; }
};
I agree that virtual-static-data and virtual-static-member-functions are
something that is missing in the language, can be easily added and will be
useful.
-- Etay Bogner,
-- Etay_Bogner@mail.stil.scitex.com,
-- Scitex Corp.
-- Israel.
[ 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:
<Etay_Bogner-1411951133030001@metay_pc.stil.scitex.com>Path:
arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamageReferences:
<487q1e$peq@aztec.co.za>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage From: Etay_Bogner@mail.stil.scitex.com (Etay Bogner) Newsgroups: comp.std.c++ Subject: Re: Virtual static members Date: 14 Nov 1995 16:22:47 GMT Organization: Scitex Corp. Approved: clamage@eng.sun.com (comp.std.c++) Message-ID: <Etay_Bogner-1411951133030001@metay_pc.stil.scitex.com> References: <487q1e$peq@aztec.co.za> NNTP-Posting-Host: taumet.eng.sun.com Content-Type: text X-Nntp-Posting-Host: metay_pc.scitex.com Content-Length: 717 X-Lines: 26 Originator: clamage@taumet