Last active
April 12, 2018 18:44
-
-
Save Aravin/bb6280886d2a0886426d8f09e47c8ec0 to your computer and use it in GitHub Desktop.
Private Protected Access Modifier in CSharp C#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code from Project 1 | |
namespace FirstAssembly | |
{ | |
public class FirstClass | |
{ | |
private protected static void FirstMethod() | |
{ | |
Console.WriteLine("Private protected method called..."); | |
} | |
} | |
} | |
// Code from Project 2 | |
using FirstAssembly; | |
namespace SecondAssembly | |
{ | |
public class SecondClass : FirstClass | |
{ | |
public static void SecondMethod() | |
{ | |
FirstMethod(); // No access to the base class since it is private protected. | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment