Templates allow us to write generic classes (called template classes) and generic functions(called template functions) that can work with generic data-types.
Continue reading “C++ – Templates”
Lambdas or Lambda Expressions were introduced into the standard in C++11.
Continue reading “C++ – Lambdas”
I was once asked in an interview about the importance of memory alignment. I had absolutely no clue as to what it meant or why it was important in high performance/low latency programming.
Continue reading “C++ – Memory Alignment”
If you have ever wondered how a program written in C++ or any other language finally gets executed on the hardware and gives us the intended results,this is the article for you. This article will give you a high level overview of what happens behind the scenes.
Continue reading “LifeCycle of a program – A C++ Perspective”
Typecasting in C++ allows us to perform conversion between types.
Continue reading “C++ – Type Casting”
In C++, memory allocated from heap has to be freed manually. But there could be situations where the programmer forgets to deallocate the memory and causes what is known as memory leakage.
Continue reading “C++ – Smart Pointers”
Polymorphism is the ability of an object to exhibit multiple behaviors. C++ allows two types of polymorphism, Static and Dynamic. Static polymorphism happens at compile time via function overloading whereas Dynamic polymorphism is exhibited at run time via function overriding.
Continue reading “C++ – Polymorphism”
strcat() and strcpy() are two functions that work with the c-style strings. While the former concatenates two strings, the latter copies one string into the other. Both these functions have been the reason for multitude of bugs in many applications. Although, they are simple functions to use, most programmers are oblivious to their implementation details which has resulted in quirky and hard-to-debug behaviors in several applications .
Continue reading “C++ – Be wary of strcat() and strcpy()”
A class or a function can be made a friend of another class in C++. A friend gets access to all the private members and protected members of the class to which it becomes a friend.
Continue reading “C++ – ‘Friend’”
A constructor is a special member function that is automatically called when you create an instance of a class. Continue reading “C++ – Constructor”
The idea of inheritance implements an IS-A relationship between classes.
Continue reading “C++ – Inheritance”
When a class inherits from another class, it is possible to override the public methods of the base-class in the derived-class.
Continue reading “C++ – Virtual Functions”
Static keyword in C++ can often be a cause of confusion for many people because of its varied use cases. If you are one of them, hope this article helps you alleviate it.
Continue reading “C++ – Mastering ‘Static’”
Let’s see how the compilation process works in C++.
Continue reading “C++ – Scope and Linkage”
One Definition Rule or ODR is an important rule in C++ which loosely states the following.
Continue reading “C++ – One Definition Rule”
People discuss shallow copy and deep copy in the context of classes.
Continue reading “C++ – Deep Copy vs Shallow Copy”