Python Forum

Full Version: setting base class attribute
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
how can i ensure that an attribute can only be set from derived class? if some other class tries to set it, it should be illegal
Please, give more information. What you're describing doesn't make sense for something you should need to worry about, as a parent object should never care what "extra" baggage derived/child classes add on. That's sort of the whole point of having derived classes, after all, adding functionality to a base class.