nag wrote: > Hi, > > Even if your Base doesn't have > any data members but needs to do something when it is instantiated (like > notify some third party about it), you still need to have a constructor. > > If, by some chance, your Base class doesn't need to do anything when it is > instantiated as part of some other object (of a derived class), then the > default (compiler-provided) constructor would undoubtedly be sufficient. > > I got the above lines from the following posting: > http://bytes.com/forum/thread139508.html > > > > -nag.
Just because you find something on the Internet does not make it correct. Every base class and derived class should have a constructor AND must have a 'virtual' destructor. Writing both regardless of the class in a base-derived scenario is a good habit to get into. The #1 thing I've seen people NOT do is not make their destructors 'virtual'. Another good habit to get into is to keep the depth of the hierarchy being built small and specific. The temptation to go uber-generic and template every last line of code is always there, but rarely necessary. Classes are, IMO, superior to templates and should be preferred. -- Thomas Hruska CubicleSoft President Ph: 517-803-4197 *NEW* MyTaskFocus 1.1 Get on task. Stay on task. http://www.CubicleSoft.com/MyTaskFocus/
