Which of the following statements a) , b) or c) is false?
A) With inheritance, every object of a subclass also may be treated as an object of that subclass's base class.
B) We can take advantage of this xe ""derived-class-object-is-a-base-class-object" relationship[derived class object is a base class object relationship]""subclass-object-is-a-base-class-object" relationship to place objects related through inheritance into a xe "list of base-class objects"list, then iterate through the list and treat each element as a base-class object.
C) The following code places CommissionEmployee and SalariedCommissionEmployee objects (c and s) in a list, then for each element displays its string representation and earnings-this is an example of xe "polymorphism"polymorphism:
In [21]: employees = [c, s]
In [22]: for employee in employees:
) ..: print(employee)
) ..: print(f'{employee.earnings() :,.2f}\n')
) ..:
CommissionEmployee: Sue Jones
Social security number: 333-33-3333
Gross sales: 20000.00
Commission rate: 0.10
2,000.00
SalariedCommissionEmployee: Bob Lewis
Social security number: 444-44-4444
Gross sales: 10000.00
Commission rate: 0.05
Base salary: 1000.00
1,500.00
D) All of the above statements are true.
Correct Answer:
Verified
Q32: A read-only property has _.
A) only a
Q33: Consider the following code which would set
Q34: Properties are implemented as _, so they
Q35: The following code and traceback shows that
Q36: Which of the following statements a), b)
Q37: Class Time's properties and methods define the
Q39: Which of the following statements is false?
A)
Q40: Which of the following statements a), b)
Q41: Which of the following statements a), b)
Q42: Consider the following loop, which processes a
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents