Object Orientated Programming wth C++

In this class we learned how to work with variables, data types and constructs. We learned how to use control structures, create and manipulate arrays and vectors, we learned how and why to create and use classes and objects.

Let’s look at some basic data types and their values..

Source: https://www.geeksforgeeks.org/c-data-types/

Objects are mostly common nouns, when we describe an object we gather its attributes and behaviors, an object will likely become part of a class and the attributes will become the variables, the behaviors will be the methods and functions we will use to manipulate the data to each instance of the object class.

To make an example we might look at something as far from man made as say a tree, a tree can be two types – Deciduous and Coniferous, an defining attribute can be that each tree can have a name – Ash, Oak, Breech etc. other attributes might include flowering, leaf types, soil type etc. Behaviors could be growth rate, leaf fall, seed dispersal etc.

Why use O.O.P?

So you might think what can we do with this data, how can we manipulate it or why use it, well I was thinking of reforesting areas, as it turns out the UK government tried to reforest some areas and typically made a hash of it, biodiversity of plant and trees is a key component to reforestation and habitation for varying species.

With that in mind we can start to collect more data types and build bigger programs, break them off into objects and classes. That is the basis for why we use object orientated programming, as our programs grow larger it makes code easier to manage, but more than that we can take code that has already been created and inject or data into it.

With lots of different objects and their data we could build a model to best cultivate optimised growth of certain terrain, you might have been thinking why use an analogy like trees of all things, but given the context provided, what this analogy does create is the scope to what other objects and classes would be necessary to create a program such as this.