CS 1301 Lecture Notes - Lecture 15: Marsupial, Init, Myx
Document Summary
####### day 15 - object oriented programming (oop) ####### #creation of classes that are blueprints for creating types of programming. #entities each class is made up of data and functions that act on data. ## string is a class --> provides blueprint for data then functions that act on. ##to create an object of a class, you initialize the data and that allows you to use. #the functions that work on that data by using dot operator. #### create a new point of the point class mypoints = [point(10,12),point(20,21),point(30,34)] for apoint in mypoints: print(apoint) apoint. add10() print(mypoints[1]. y) p1 = point(50,60) #write function add10 that adds 10 to both x and y coordinates of point then call. ###creating own class containing attributes (data) and methods (functions) #str method gives string back rather than position in memory. #class: description of the data and methods to create a type of thing. #attribute: a data item for a particular object.