CS 1301 Lecture Notes - Lecture 15: Marsupial, Init, Myx

23 views4 pages

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.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents