In reply to bhupeshpaliwal:
If you wanna the class child class to have restricted access to the variable s then you could declare it as private only in the child class removing the need to have it in the parent. Other way could be using a function to access that variable which encapsulate some sort of restricted access like looking for the parent class if not the main starting parent class then 100% is not the child. Hope i got the question. Regards