4
Reply

Why Static Class Can Not Contain Protected Members ?

Pratul Tripathi

Pratul Tripathi

14y
13.8k
0
Reply

    Since Static classes are sealed classes, and sealed classes can not be inherited,hence it can not contain protected members, because protected members can not be inherited.

    Protected members means they can accessible from child classes,
     But the main features of static class are
    1.only contain static members.
    2.Cann't be instantiate.
    3.are sealed.

    Protected members can used when we want access of thoese variable in throughout the inherted classes but static class can not be inherited.

    Protected members mean it would be accesible fom child/inherited class. But static class cannot be inherited.

    So what is the use of Protected mmbers in Static Class. That is why Static class can not contain Protected members.