We discussed about the concept of this pointer in this article. The C++ compiler internally manages it. In general, we don’t need to worry about it. But there are scenarios where we need to use it explicitly. Resolving Ambiguity between Member and Input Variables A member function of a class deals with two types of … Continue reading “The ‘this’ Pointer Usage in C++”
The this Pointer in C++
In C++, the this pointer is generally used in the non-static member functions of a class. It refers to the address of the object the function is accessed through. Let’s understand the concept. C++ classes have mainly two types of components – properties (data) and functions. Every object, created from a class, will have a … Continue reading “The this Pointer in C++”
Static Members of a C++ Class
The class members are by default non-static. That means we can access them in the context of an object only. Each object will have its own copy of the data members. Even though the code segment is common for all objects of a class, the member functions can be called in the context of an … Continue reading “Static Members of a C++ Class”
C++ Classes and Objects
Supporting Object Oriented Programming (OOP) was one of the main reasons C++ was originally created as an extension of C. Object Oriented Programming is a software design paradigm around the objects and classes. Objects are the instances of classes. Classes are kind of blueprints for the objects that define what type of data or functionality … Continue reading “C++ Classes and Objects”
Bit Fields in C
The variable size of a standard type is always in bytes – not in fraction of bytes. For example, the size of a char type variable is 1, short type variable is 1, in type variable is 4 and so on. We can not have a variable of size half byte (4 bits) or 1 … Continue reading “Bit Fields in C”