Posts

Showing posts with the label Object Oriented Programming

Object Oriented Programming: Classes and instances BEHIND THE SCENES!

Image
Object Oriented Programming: Classes and Instances Hi! Welcome to this section! First of all,  congratulations!  You’re already halfway through the course. You should be very proud of yourself :-) In this section we are going to start talking a little bit about classes, what they are and how they can represent real objects. You will even learn that YOU are an example of Object Oriented Programming (OOP) and you didn’t even know it! So… Let’s get started! Classes are like blueprints, we use them to represent an abstract notion or idea of how we describe real world objects according to certain criteria. For example, House is the notion we have of a structure where people live that has bedrooms, bathrooms, floors, roofs, ceilings, and so on… they share some characteristics, but they don’t necessarily have to be exactly the same for us to consider them houses. This is what we would represent as a CLASS, the abstract notion of a house. Now, if we refer to a ...

Object Oriented Programming: Methods BEHIND THE SCENES!

Image
Object Oriented Programming: Methods Hi! Welcome to this second part of the Object Oriented Programming Tutorial. In this section we are going to study very powerful concepts in Object Oriented Programming.  METHODS! Let’s get started! Remember the example we worked with in the first part of the tutorial? If not, don’t worry, here we have the code to refresh your memory. We covered naming the class, the  __init__( )  function and what instances are and how to create them. Now we will discuss what  METHODS  are. The functions below  __init__( )  must be familiar to you, they are exactly like function we have been working with, BUT notice that now, these functions are inside what we call a class. This changes the scenario a little bit, but you must remember that they are still functions that can be called with an input, if necessary. Let’s dive into METHODS! When you create an instance, that instance wi...