Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!chaph.usc.edu!nunki.usc.edu!jeenglis From: jeenglis@nunki.usc.edu (Joe English) Newsgroups: comp.lang.c++ Subject: Re: Variable sized objects Message-ID: <6987@chaph.usc.edu> Date: 11 Dec 89 22:15:13 GMT References: <1262@amethyst.math.arizona.edu> <2240@dataio.Data-IO.COM> Sender: news@chaph.usc.edu Reply-To: jeenglis@nunki.usc.edu (Joe English) Organization: University of Southern California, Los Angeles, CA Lines: 19 bright@dataio.Data-IO.COM (Walter Bright) writes: >Variable sized objects are quite useful and work fine. The only thing >you cannot do is derive from a variable size class. > >Does anyone know how to *prevent* a derivation from a particular class >(i.e. cause a compile-time error if you try it)? One way would be to add language support for variable-sized objects by allowing zero-length arrays as the last data member (and *only* as the last member) of a class. Then the compiler could take care of disallowing inheritance. Then again, C++ already has enough tricky semantics... --Joe English jeenglis@nunki.usc.edu