From: Al Christians Newsgroups: comp.os.msdos.djgpp Subject: Re: Pascal units in c++ Date: Thu, 16 Apr 1998 10:47:07 -0700 Organization: Trillium Resources Corporation Lines: 30 Message-ID: <3536441B.5160@easystreet.com> References: <01bd6894$499fcd60$151601bf AT cb001687> <6h4hu8$hba AT news DOT u-strasbg DOT fr> <01bd694d$74dbc4c0$151601bf AT cb001687> Reply-To: achrist AT easystreet DOT com NNTP-Posting-Host: dial-35-033.easystreet.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk It has been conventional in C++ to use the class as the standard sub-assembly of a system. Typically, each class gets its own source file (corresponds to implementation part of a pascal unit) and its own header file (corresponds to the interface part of a pascal unit). The standard objective is to be as OO as possible, but things that don't go into classes either get put into the same file as the most closely related class (e.g. standalone functions) or into separate header files that might not have any matching executable source (like constants and type definitions). To couple another class to a class more intimately than is possible through its header file, the 'friend' keyword is used. Several of the OO lower-CASE tools assume that this is the only way that C++ ever gets modularized. There is a book on big C++ projects by Lakos, where he recommends a change in this practice, and what he advises looks a lot more like Pascal units. He says to put groups of C++ classes that really can't be used apart from each other into the same source file, and expose them to the outside world through a single header file. Al Jasper van Woudenberg wrote: > > Thanks, but that was not really what i meant. What i meant was how i should > program structures like units in c++, what the equivalent of a unit is in > c++, and how i should use it. > > Greetnix, > Jasper.