known as private variable class is an example of encapsulation as it encapsulates all the data that is member functionsvariablesetc consider real-life example of encapsulationin companythere are different sections like the accounts sectionfinance sectionsales section etc the finance section handles all the financial transactions and keeps records of all the data related to finance similarlythe sales section handles all the sales-related activities and keeps records of all the sales now there may arise situation when for some reason an official from the finance section needs all the data about sales in particular month in this casehe is not allowed to directly access the data of the sales section he will first have to contact some other officer in the sales section and then request him to give the particular data this is what encapsulation is creating base class class basedef __init__(self)protected member self _a creating derived class class derived(base)def __init__(self)calling constructor of base class base __init__(selfprint("calling protected member of base class"print(self _aobj derived(obj base(calling protected member outside class will result in attributeerror print(obj