Class and Object

Posted on February 5, 2019

Class and Object

Class: a mapping between computer programs and the entities from real/thinking realm. It’s a blueprint that defines a set of attributes that will characterize any object that is instantiated from this class.

Class encapsulates data (variables) and operations (methods) on those data

A good class design depends on behavior (method) and attribute (variables). Behaviors need to be relevant with the class

For example, for the class definition below, method print_file shouldn’t belong to Student, rather it should belong to Printer