Article View: csu.cs.200
Article #208Assignment 5 Que Constr
From: Corby S. Hudnall
Date: Sat, 21 Mar 1998 00:00
Date: Sat, 21 Mar 1998 00:00
58 lines
1986 bytes
1986 bytes
This might be of interest to others...
Corby S. Hudnall wrote:
>
> donald johnson wrote:
> >
> > I'm a bit confused about the need for constructors/destructors for
> > the Queue class. I have a statically instantiated DLL as my only
> > variable.
>
> statically instantiated as in:
>
> template<class TYPE>
> class Queue {
> private:
> DLL<TYPE> dll;
> ...
>
> or statically instantiated as in:
>
> template<class TYPE>
> class Queue {
> private:
> static DLL<TYPE> dll;
> ...
>
> I assume you mean the former since when I write the code:
>
> Queue<int> q1, q2;
> ...
>
> I want there to be two queues with two underlying DLLs rather than two
> queues with one underlying DLL. Food for thought.
>
> > I just put two inline 'structors...
> > Queue () {};
> > ~Queue () {};
> >
>
> It's always a good idea to supply a constructor and/or destructor so
> that the compiler doesn't have to create a default one for you. Even if
> there's no body now, there is no guarantee that at some point in the
> future you won't need them. In short, better to have them and not need
> them then vice versa.
>
> [snipped for brevity]
>
> cheers
> Corby
--
Corby S. Hudnall Senior, Spring 1998
Colorado State University http://WWW.CS.ColoState.EDU/~hudnall
Department of Computer Science hudnall@CS.ColoState.EDU
Software is neither science nor engineering. It's really an
obscure form of poetry.
Technical Details
Message-ID:
<3514A4C5.3D0D055C@cs.colostate.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 127144,fe757b5b7ab8cc64,start X-Google-Attributes: gid127144,public From: "Corby S. Hudnall" <hudnall@cs.colostate.edu> Subject: Assignment 5 Que Constr Date: 1998/03/21 Message-ID: <3514A4C5.3D0D055C@cs.colostate.edu> X-Deja-AN: 336456155 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Organization: Colorado State University Mime-Version: 1.0 Newsgroups: csu.cs.200