[omniORB] How can be interface destructors compiled to be virtual

Bruce Visscher bruce.visscher at gmail.com
Sat Apr 12 14:30:39 BST 2008


Why do you want to do that?

The only reason to make a destructor virtual is so you can derive from
it, allocate a derived class object on the heap via new then delete
the object using a pointer to a base class object.  Sequences are not
polymorphic in nature(*), so I can't imagine a scenario in which this
would be appropriate or desirable.

I personally think it is okay to derive from classes in order to
extend the functionality in a non-polymorphic manner without making
the destructor virtual.  I know this is not a universally held point
of view. I recently came across this blog:

http://bannalia.blogspot.com/2008/02/derivation-without-virtual-destructor.html

(*) I think you could design a polymorphic sequence class but I don't
believe CORBA sequences had that as a design goal.

On Sat, Apr 12, 2008 at 12:12 PM, Luo Yongheng <langsir at yeah.net> wrote:
>
>
> I'm not familiar with omniIDL compiler. Is there any option with which
> compiler can make all sequence classes' destructors virtual? I found
> destructors for all sequences and their derived classes are non-virtual. I
> have many many sequence classes in my application. Non-virtual destructor
> makes me hard to implement some functionalities.
>
> Thanks.
> _______________________________________________
>  omniORB-list mailing list
>  omniORB-list at omniorb-support.com
>  http://www.omniorb-support.com/mailman/listinfo/omniorb-list
>
>



More information about the omniORB-list mailing list