Sealed vs. Private constructor

  • Thread starter Thread starter wiredless
  • Start date Start date
W

wiredless

Hi,

To minimize resource usage on a WinCE app I want to seal classes and methods
that do not get inherited. Is it still good practice to set the class
constructor to private or is it covered by using sealed?
 
They're used for difference scenarios. One prevents object creation, one
prevents inheritance. If you don't want the ctor visible, make it private,
regardless of whether you want to seal the class or not. If you don't want
it to be inheritable, then seal it. The scope of the ctor has no relevence
on it.

-Chris
 
Back
Top