I have a need for two slightly different classes, that have the same members, but one of the classes needs to have less interaction possibilities by the user. I am hoping to inherit the second class from the first.
Is there a way to restrict access to parent methods from the child class, so that if somebody creates a child object, they will not be able to access certain parent class methods (which are public in the parent class)?
I have a need for two slightly different classes, that have the same members,
Share
You should have a base abstract class to hold the things in common of both classes, and then let the other two classes inherit from it and add methods and properties, etc.
MyClass1has:SharedProperty,SharedMethod, andMethod1.MyClass2has:SharedProperty,SharedMethod, andMethod2.