Question: You are given the following code: class Employee: Common base class for all employees def __init__(self, name= , salary=0,date=): self.__empName = name self.empSalary =

You are given the following code:

class Employee: """Common base class for all employees""" def __init__(self, name= " ", salary=0,date=""): self.__empName = name self.empSalary = salary self.empDate= date def printall(self): print(self.empName,self.empDate,self.empDate) x=Employee("John", 15000, "20/1/2018") print(x.empName) Which of the following is true?

There will be an Error because it is against the object oriented programming principles

There will be Error because 'Employee' object has no attribute 'empName' The attribute cannot be accessed.

There will be Error because print(x.empName) should be print(x.__empName)

The output will be John and there will be no error.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!