[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: baby steps



Some quick comments from the peanut gallery.

1) Virtual destructor are generally a good thing if you are deriving
classes.
2) You might also want to make display and blit virtual.
3) In graphic why did you have the comment /* these should be protected? */
You probably don't want people arbitarily modifying Width and Height
so yes.  If you want to allow people to view width and height create
an inline member variable.  If you want to be able to change the size
of the graphic create a function to do it rather than rely on the user
to modify buffr, width, and height appropriately.
4) Your destructor for graphic and descendants leak memory.  With the way
you allocated it you destory it like:

graphic::~graphic(){
  int i;
  for (i=0;i<itsHeight;i++)
    delete itsBuffer[i];
  delete[] itsBuffer;
}

5) (Minor note) Whitespaces (and even comments) don't kill people.

Dennis Payne
payned@rpi.edu