OOP (object oriented programming) An example of classes in python. ***attached as a pdf because study monkey does not accept .py files ***

1 Page
77 Views
Unlock Document

Department
Computer Science
Course
CSC148H1
Professor
Steve Engels
Semester
Winter

Description
class Duckobject The Duck allows users to play with it in Ducklike ways def initself nameSir Quacksalot position0 Create a Duck with a name a given position and an empty stomachselfnamenameselfpositionpositionselfstomachdef swimself distance1 Move the duck forward the given distance selfpositiondistancedef eatself fishNone Ingests the fish provided selfstomachappendfish
More Less

Related notes for CSC148H1

Log In


OR

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


OR

By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.


Submit