Pop quiz for you C # developers out there. Will the following code compile?
//In Foo.dllpublic class Kitty{ protected internal virtual void MakeSomeNoise() { Console.WriteLine("I'm in ur serverz fixing things..."); }}//In Bar.dllpublic class Lion : Kitty{ protected override void MakeSomeNoise() { Console.WriteLine("LOL!"); }}
If you had asked me that yesterday, I wocould have said hell no. You can't override an internal method in another assembly.
Of course, I wowould have been WRONG!
Well the truth of the matter is, IWasWrong. This came up in an internal discussion in which I was unfairly complaining that certain methods I needed to override were internal. In fact, they wereprotected internal. Doesn't that mean that the method is bothprotected And internal?
Had I simply tried to override them, I wocould have learned that my assumption was wrong. For the record...
protected internalMeansprotected OR internal
It's very clear when you think of the keywords as the union of accessibility rather than the intersection. Thusprotected internalMeans the method is accessible by anything that can accessprotectedMethod UNION with anything that can accessinternalMethod.
As the old saying goes, when you assume, you makeAssOutUAndMe. I never understood this saying because when I assume, I only make an ass of me. I really think the word shoshould simply beAssme. As in...