152x Filetype PDF File size 0.12 MB Source: www.astro.rug.nl
Object Oriented Programming for Python Bas Roelenga Rijksuniversiteit Groningen Kapteyn Institute February 20, 2017 Bas Roelenga (RUG) February 20, 2017 1 / 21 Why use Object Oriented Programming? Code will be more readable and organized There is less duplicate code, i.e. a more eļ¬cient program Makes it easier to write larger programs Bas Roelenga (RUG) February 20, 2017 2 / 21 What is Object Oriented Programming? Atype of programming which uses object These objects can be everything What is an object? Astructure that contains data Data from this structure can be manipulated Wecan request the data from this structure Bas Roelenga (RUG) February 20, 2017 3 / 21 Syntax structure of Object Oriented Programming Constructing a class 1 class YourClass: 2 def i n i t ( s e l f ) : Listing 1: Creating a python class Two key things to note class def __init__(self) (constructor) Bas Roelenga (RUG) February 20, 2017 4 / 21
no reviews yet
Please Login to review.