.net how to make a non static class without a constructor? -


in .net there exist classes registrykey aren't static example:

registrykey rk=registry.localmachine; 

the above class not static (as far understand) yet has no constructor example

registrykey rk=new registrykey(); 

isn't valid (the registry key class has no constructors defined)

i searched web , yet couldn't find information

when write following

class myclass2 {     protected myclass2(int x)     {     } } 

i myclass2.myclass2 inaccessible due it's protection level

what want know if there no way other making constructor private how can there different messages classes registerykey , myclass2 ?

registrykey has 2 private constructors parameters. error message because there isn't default constructor registrykey(), because if define constructor parameters, implicit parameterless constructor isn't generated. being them private, don't see them.

technically abstract classes can't built new. create private derived class (or internal derived class).


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -