CSC148H1 Lecture Notes - Lecture 3: Abstract Data Type, Rational Number, Init
katrinasavvy and 38715 others unlocked
1
CSC148H1 Full Course Notes
Verified Note
1 document
Document Summary
In python - develop classes(advanced data types, primitive data types) for the client code(other programmers) __str__ to print an instance of the class (a string way of showing the object), uses format. Manage attributes - ex, in a rational number, the denominator does not get the value 0. Python gives you more opportunity to design what you actually want. Class: (abstract/advanced/compound) data type (adt = abstract data type) It models a thing or concept (we call this an object) based on its common or important attributes (parameters) and actions(methods) in a specific project. In other words, it bundles together attributes and methods that are relevant to each instance of those objects. We are asking the object to tell us information. A rectangle is a shape has_a vs is_a relationship: A chair has an armrest, has a backrest, has a seat (composed of several objects). Vehicles are objects, composed of several other objects(wheels, seats, windows, etc, etc)-