Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!voder!procase!roger From: roger@procase.UUCP (Roger H. Scott) Newsgroups: comp.lang.c++ Subject: Re: virtual static class functions Message-ID: <107@pascal.procase.UUCP> Date: 29 Mar 90 06:30:20 GMT References: <38579@cornell.UUCP> <2380@dataio.Data-IO.COM> Reply-To: roger@procase.UUCP (Roger H. Scott) Organization: proCASE Corporation, Santa Clara, CA Lines: 18 In article <2380@dataio.Data-IO.COM> bright@Data-IO.COM (Walter Bright) writes: >In article <38579@cornell.UUCP> deb@svax.cs.cornell.edu (David Baraff) writes: >The virtual table is found through the this pointer. Static members, by >definition, aren't invoked for a specific instance of a class, so there >is no this pointer, and no way to get to the virtual table. Not so fast! Static member functions *may* be invoked without a pointer, in which case they must be "de-virtualized" by explicit qualification with a class name, e.g. "klass::static_member_function();", but they may *also* be invoked through a pointer, e.g. "klass *k = ...; k->static_member_function();". Such an invocation, while legal, is pointless today because no use whatsoever is made of the object involved. If static member functions could be virtual then the object involved would be used to determine which function to call. The called routine would still have no automatic connection to the object. I think I asked Bjarne S. about this a while back, and he said that, while reasonable, this was not high on the list of priorities. Another interesting thing to think about is virtual static *data* members (virtual non-static data members make no sense).