On Fri, Nov 20, 2009 at 1:31 PM, James Robinson <jam...@google.com> wrote:
> On Fri, Nov 20, 2009 at 12:59 PM, Peter Kasting <pkast...@google.com>wrote: > >> For a concrete example, take AutocompleteEditController, which is declared >> in autocomplete_edit.h. This is an abstract base class that names several >> different methods. The purpose of the class is to insulate the >> functionality the edit needs from whatever code actually implements that >> functionality. However, the edit doesn't create or own pointers to its >> controller, and never deletes its controller, so this abstract class doesn't >> have a virtual destructor. The pattern here is "implements interface X" as >> opposed to the "is a specialized type of an X" pattern of parent and child >> classes. >> > > What's the benefit of omitting the virtual destructor? > I'm not trying to say it has massive benefits. I'm trying to make concrete the rather abstract statement that we have patterns right now where objects don't specify destructors. If you want me to argue for it, then I would probably say that it's a little simpler and clearer without a destructor, and for someone used to reading our code it's a tipoff that this is an instance of the "interface" class pattern. If I were to add a destructor, I'd declare one in private as opposed to adding a virtual one, again just to emphasize that this is an interface as opposed to a parent of more specialized children. Not a very important set of reasons. If you feel violently, write the patch. I won't stop you. PK -- Chromium Developers mailing list: chromium-dev@googlegroups.com View archives, change email options, or unsubscribe: http://groups.google.com/group/chromium-dev