Courses
Tutorials
Practice
Data Structure
Java
Python
HTML
Interview Preparation
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
SQL
Web Development
System Design
Aptitude
GfG Premium
Similar Topics
C++
4.3K+ articles
C++ Programs
2.4K+ articles
CPP Examples
714+ articles
cpp-operator
59+ articles
cpp-class
57+ articles
cpp-constructor
37+ articles
C++-Class and Object
33+ articles
C++-Constructors
29+ articles
cpp-inheritance
28+ articles
cpp-operator-overloading
23+ articles
CPP-OOPs
47 posts
Recent Articles
Popular Articles
How to Use Initializer Lists in Constructors in C++?
Last Updated: 01 March 2024
In C++, the initializer list in constructors can be used to initialize member variables with a list of values. In this article, we will learn how to use initializer lists ...
read more
cpp-constructor
C++
C++-Constructors
C++ Programs
Picked
CPP-OOPs
CPP Examples
How to Define a Move Constructor in C++?
Last Updated: 01 March 2024
In C++, we have amove constructor which is a part of C++11 move semantics and is used to handle resources for temporary and rvalue objects. In this article, we will learn ...
read more
cpp-class
cpp-constructor
C++
C++-Constructors
C++ Programs
Picked
C++ 11
CPP-OOPs
CPP Examples
How to Write Getter and Setter Methods in C++?
Last Updated: 27 February 2024
In C++, classes provide a way to define custom data types that can encapsulate data and methods related to that data. Getter and setter methods are commonly used to access...
read more
cpp-class
C++
C++ Programs
Picked
CPP-OOPs
CPP Examples
How to Declare a Static Data Member in a Class in C++?
Last Updated: 22 February 2024
In C++, when we declare a member as static, then it means that the member will have only one copy that is shared by all objects of that class and we don't need any object ...
read more
cpp-class
C++
C++-Static Keyword
C++ Programs
Picked
CPP-OOPs
CPP Examples
How to Create a Virtual Function in C++?
Last Updated: 22 February 2024
In C++, a virtual function is a member function that is declared in a base class and redefined in a derived class. It enables runtime polymorphism in our program. In this ...
read more
C++
C++-Virtual Functions
C++ Programs
Picked
CPP-OOPs
CPP Examples
How to Override a Base Class Method in a Derived Class in C++?
Last Updated: 21 February 2024
Function overriding is a concept in object-oriented programming languages, in which a function/method of a parent class is redefined in its child class to change its behav...
read more
C++
C++ Programs
Picked
CPP-OOPs
CPP Examples
How to Use Default Arguments in Function Overloading in C++?
Last Updated: 19 February 2024
In C++, we can provide the default values for the input arguments into the functions and it is also supported in function overloading. In this article, we will learn how t...
read more
C++
C++-Function Overloading and Default Arguments
C++ Programs
Picked
cpp-overloading
CPP-OOPs
CPP Examples
How to Declare a Static Variable in a Class in C++?
Last Updated: 15 February 2024
In C++, a static variable is initialized only once and exists independently of any class objects so they can be accessed without creating an instance of the class. In this...
read more
cpp-class
C++
C++-Static Keyword
Static Keyword
C++ Programs
Picked
CPP-OOPs
CPP Examples
How to Handle Incorrect Values in a Constructor?
Last Updated: 12 February 2024
In C++, constructors are used to construct and initialize the object of its class. If incorrect values are given to the constructor, then it may cause inconsistency in a p...
read more
C++
C++-Constructors
C++-Exception Handling
C++ Programs
Picked
CPP-OOPs
CPP Examples
How to Overload the Less-Than (<) Operator in C++?
Last Updated: 12 February 2024
In C++ we have an operator called less than operator () which checks if the left side operand is smaller than the right side operand or not. In this article, we will learn...
read more
C++
C++-Operator Overloading
Operator Overloading
C++ Programs
Picked
CPP-OOPs
CPP Examples
How to Create a Template Class in C++?
Last Updated: 07 February 2024
In C++, template classes are used to create generic classes that can work for different data types. In this article, we will learn how to create a template class in C++.Cr...
read more
cpp-template
C++
C++ Programs
Picked
CPP-OOPs
CPP Examples
How to Create a Pure Virtual Function in C++?
Last Updated: 07 February 2024
In C++, pure virtual functions are those functions that are not implemented in the base class. They are instead implemented in the derived classes if necessary. In this ar...
read more
C++
C++-Virtual Functions
C++ Programs
Picked
CPP-OOPs
CPP Examples
How to Overload the Function Call Operator () in C++?
Last Updated: 07 February 2024
In C++, operator overloading allows the user to redefine the behavior of an operator for a class. Overloading the function call operator () allows you to treat objects lik...
read more
cpp-operator
C++
cpp-operator-overloading
C++ Programs
Picked
CPP-OOPs
CPP Examples
When to Use Virtual Destructors in C++?
Last Updated: 25 January 2024
In C++, destructors are special members of a class that frees memory occupied by an object when it goes out of scope. A virtual destructor is a special form of destructor ...
read more
cpp-virtual
cpp-inheritance
cpp-destructor
C++
C++ Programs
Picked
CPP-OOPs
CPP Examples
How to Overload the Multiplication Operator in C++?
Last Updated: 25 January 2024
In C++, the multiplication operator is a binary operator that is used to find the product of two numeric values. In this article, we are going to learn how to overload the...
read more
C++
cpp-operator-overloading
C++ Programs
Picked
CPP-OOPs
CPP Examples
1
2
3
4
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our
Cookie Policy
&
Privacy Policy
Got It !