Friday, 13 February 2015
CSC148H1S - My summary of Object-Oriented programming concepts
Since the beginning of the semester, we are talking about classes which are object-oriented programs. If you want to create a class in python, you just need to write class and the name of the class and if you want to inherit that in the paranthesis you just need to put the superclass. Every class has to have an __init__ method which gets called every time you create a class. Also the first parameter of every class should be self. Self refers to the specific object created from that class. If a function is within a class we call it a method.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment