Skip to content

Instantly share code, notes, and snippets.

@SimonCropp
Created April 19, 2012 09:25
Show Gist options
  • Select an option

  • Save SimonCropp/2419932 to your computer and use it in GitHub Desktop.

Select an option

Save SimonCropp/2419932 to your computer and use it in GitHub Desktop.
Bypass Protected Constructor
public class BaseClass
{
protected BaseClass()
{
}
}
public class BypassClass : BaseClass
{
public static BaseClass GetBaseClass()
{
return new BypassClass();
}
}
public class Foo
{
public void Bar()
{
BaseClass baseClass = BypassClass.GetBaseClass();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment