Path: utzoo!attcan!uunet!aplcen!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!rpi!bu.edu!orc!bbn.com!nic!hri!sparc7!roman From: roman@sparc7.hri.com (Roman) Newsgroups: comp.lang.c++ Subject: Re: Filesystem classes: how to? Message-ID: <1990Jun7.214800.14989@hri.com> Date: 7 Jun 90 21:48:00 GMT References: <1567@swbatl.sbc.com> Sender: news@hri.com Reply-To: roman@sparc7.hri.com (Roman) Organization: Horizon Research Lines: 40 In article <1567@swbatl.sbc.com>, gilstrap@swbatl.sbc.com (3929) writes: > Okay, anyone want to give a stab at a set of classes to implement a Unix file > system? My initial thoughts were: > > FileSystemNode > | > +------------+--------------+-------+---------+ > | | | | | > Directory CharacterFile BlockFile Link SymbolicLink > | > +-------------------+ > RegularFile CharacterSpecialFile > [deleted] > Anyone have any suggestions? > > Brian R. Gilstrap > uucibg@swbatl.uucp OR ...!{ texbell, uunet }!swbatl!uucibg > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~ > "You spend your whole life just piling it up there. You got stacks and stacks > and stacks. Then Gabriel comes and taps you on the shoulder, but you don't see > no hearses with luggage racks." > --- Don Henley > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~ > Copyright (c) 1990 by Brian R. Gilstrap. You may redistribute (my portions of) > this material for free if and only if your recipients may also do so. You have to design everything into FileSystemNode, that is create virtuals for all possible subclasses, so you can access them through the base pointer. You also have to somehow know the type in run time ( or have the base class virtuals respond appropriately). Not very pretty, but the only way I found. I guess it's OK when you design the whole system. Hard to extend tho.