Author Archive

Operator overloading in classes in C++

Written by Hamza. Posted in C++

operator overloading

After a lengthy break, i’m back with my series on object oriented programming in C++ made easy for beginners. As you may recall, I had started this series as a sort of  a basic guide for programmers who were just delving into the basics of OOP in C++. I hope by now all of you understand the basic concepts behind classes and how they are used. All of that prior knowledge will be required, as today I am going to be talking about the concept of operator overloading in classes in C++.

Using getters in C++

Written by Hamza. Posted in C++

getters in C++

Now that we have had a look at setters in C++, let us move on the the use and concept of getters. Getters, or accessors, are often found alongside setters in a class, and are extremely vital in object oriented programming.

Introduction to Classes in Object Oriented Programming C++

Written by Hamza. Posted in C++

classes in C++

You may recall i started a  series about the basics of object oriented programming in C++. This is the second article of the series. Here, I give you an introduction to classes in C++, explaining about the basic syntax and structure, giving an example to illustrate just how to instantiate and use an object after declaring a class. 

The arrow operator (->) in C++

Written by Hamza. Posted in C++

arrow operator c++

Let us now look at another interesting feature that pops up whenever dealing with classes in C++: the arrow operator. The arrow operator is used to access member functions within a class through a pointer. It is a very useful feature and makes object oriented programming in C++ a lot easier.

Usage of this Pointer in C++

Written by Hamza. Posted in C++

this pointer c++

Thus far in this series on object oriented programming in C , we have learnt the basics of classes and objects and have touched upon the private data members and public member functions, including use of getters and setters in C . When dealing with a class, we create different objects and call a number of functions on them. Have you ever wondered: How does the compiler know on which object the function was called and to change the variables of which object inside that function? This is done using this pointer in C .