Sunday, 26 January 2014
Object-Oriented Programming
Object-Oriented Programming (OOP) is a programming paradigm. OOP represents concepts as objects that have attributes which describe the object. For example the class Point itself is an object which has x,y coordinates as attributes. These attributes will describe the functionality of the object Point. The greatest thing which I have so far learned about OOP is inheritance. Inheritance is when a class such as Exception is used when creating another Exception class. For example, this is what the header of an inherited class would look like (class MyException(Exception) ). This will allow MyException to inherit all of the attributes of the Exception class without having to repeat all of the code in Exception. Also in addition to the class header to actually inherit from the Exception class you would have to call the __init__ method on the Exception class as well. (Exception__init__()). There are many areas of OOP and this is just the beginning.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment