Re: inhibit compiler warning C4624 for a class hierarchy



"Ben Voigt" wrote:
For this particular hierarchy, that's completely acceptable and intended. The objects should be allocated on the heap, used polymorphically, and deleted using a base class function.

Can I mark the base class in any way such that this message isn't generated for derived classes? Using #pragma warning (disable : 4624) in the header file has the undesirable side effect of inhibiting the warning for unrelated classes.


You can make destructor protected, so it will be availabale for derived classes while unavailable for outside users of a class.

Alex

.



Relevant Pages

  • Re: Not pure virtual functions and mixing virtual and non virtual methods
    ... Should I call base class implementation or not? ... But doing the above assumes that one answer is good for all, that all derived classes will want the base class method called in the same way. ... More generally, the way I see it, if you combine invariant implementation with variant parts, you have no elegant way to change the variant part. ... Following them will remove all inheritance relationships. ...
    (comp.object)
  • This one took weeks to resolve
    ... would be better designed as deriving from a base class form. ... control in the Windows generated code. ... These derived classes where the only place in a project ... Private sub Btn_ClickHandles btn.click ...
    (microsoft.public.dotnet.languages.vb)
  • Re: How many bytes per Italian character?
    ... override the InitState() function so it needs to be pure virtual. ... derived classes call up to them anyway; ... both the base class and derived class. ...
    (microsoft.public.vc.mfc)
  • Re: Inheritance and Interfaces
    ... Talk about having a "duh" moment. ... >You only need to implement INotifyPropertyChanged in the base class, ... > Public Property NameAs String ... >The Overridable Sub OnPropertyChanged allows derived classes to raise ...
    (microsoft.public.dotnet.languages.vb)
  • Re: How many bytes per Italian character?
    ... override the InitState() function so it needs to be pure virtual. ... derived classes call up to them anyway; ... both the base class and derived class. ...
    (microsoft.public.vc.mfc)