Object programming C++
Hi and welcome in my first talks about object programming!
As first step i want talk about different ways to make application. We can use few types of programming languages:
- functional,
- structural,
- object oriented
Why object programming is that strong? Because that types of languages are the best to create business applications and games. You can make an object and have state of object inside. So roles are very simply, but you need to understand idea of OO (object oriented) programming.
Languages which are created as OO have the smallest object as root. That mean everything comes from pre-object. That is why C++ is not fully objective,because C++ is structural based and don't have it, but have objectivity so it can be objective (but never fully objective). Root of C++ is C which is structural language and some one wanted to create successor of C with additional options, but "as backward compatible as possible". That is why C++ is strongly connected with C - of course the differences are big enough, but as you know languages like D, JAVA and C# tried to be next generation of C-similar languages. That's why you can almost easily learn one and then start learning others simply, but there is DANGEROUS. The languages are similar just in theoretical way! Everyone has his own small differences which are important for working of application.
What is object?
Object is an abstract data structure. You can imagine it a parking place in your computer memory. Where you have digits, characters and objects as not defined data.
How to create that data structure?
class cake {
protected:
char[] listOfIngredients;
public:
cake() {};
void make();
~cake() {};
int main() { }; }
The most important here is word class. Classes are a recipe for creating an object. You can think about it as a cake. In my cake I have milk, sugar, flour and chocolate - listOfIngredients. Now, when I have all i need to mix it - make(). Conclusion - class got things in variables which are necessary for creating something and how to make it in functions.
Create an object:
Cake applePie;
After that operation we have and object in our memory and it looks some like that:
So that is all for now, give me feedback and look read next episode.
Have a nice day!