1.

Observe the following Python code and answer the questions (i) and (ii):(i) How is data member „count‟ different from data member "Author"?(ii) Fill in the blanks:B= BOOK()______________________________ #Write statement to invoke Function 2______________________________ #Write statement to invoke Function 3

Answer»

(i) Data member "count" is a Class attribute whereas the data member "Author" is an Instance attribute.

Class Attributes belong to the class itself. These attributes will be shared by all the instances. Such attributes are defined in the class body part, usually at the top, for legibility.

Attributes defined for each class instance are known as Instance Attributes. These are called instance attributes and they belong to each instance/object of a class.

(ii) B.display()

BOOK.bookcount()



Discussion

No Comment Found

Related InterviewSolutions