Aman Kumar has Published 55 Articles

How to call a virtual function inside constructors in C++?

Aman Kumar

Aman Kumar

Updated on 30-Jun-2025 11:22:35

854 Views

In C++, calling a virtual function inside a constructor or destructor is dangerous and should generally be avoided. Following are the reasons to avoid calling: When a constructor (or destructor) is running, the object is not fully built (or fully destroyed). ... Read More

Assertions in C/C++

Aman Kumar

Aman Kumar

Updated on 18-Jun-2025 18:46:54

448 Views

What is an Assertions in C/C++? An assertion is a statement used to test assumptions made by the program. When an assertion fails, the program displays an error and stops. This is mainly used for debugging. In C and C++, assertions are handled using the assert() macro defined in the ... Read More

Conversion Operators in C++

Aman Kumar

Aman Kumar

Updated on 18-Jun-2025 18:35:59

2K+ Views

What is Conversion Operator Conversion operators are a type of operator overloading in C++. These operators are commonly known as type-cast operators. They enable a class or structure to specify how an object should be converted into another data type. Sometimes we need to convert concrete-type objects to some other ... Read More

Placement new operator in C++

Aman Kumar

Aman Kumar

Updated on 18-Jun-2025 18:33:22

1K+ Views

In C++, we allocate the memory dynamically using the new operator. But there is a special version of this operator known as placement new operator. The new operator performs two things. It allocates memory, and then constructs an object in allocated memory. But for the placement new operator, it ... Read More

Can a C++ virtual functions have default parameters?

Aman Kumar

Aman Kumar

Updated on 20-May-2025 19:29:14

804 Views

Yes, C++ virtual functions can have default parameters. The default parameter is the value provided during function declaration, such that the value can be automatically assigned if no argument is passed to them. In case any value is passed the default value is overridden and becomes a parameterized argument. Virtual ... Read More

C++ Program to Implement the String Search Algorithm for Short Text Sizes

Aman Kumar

Aman Kumar

Updated on 20-May-2025 18:50:55

437 Views

Searching for a substring within a short text is a common operation in many C++ programs, like as small-scale text editors, command line utilities, and education projects. So, in this article, we will implement a string search algorithm for short text sizes. Importance of String Search String search algorithms find ... Read More

Array class in C++

Aman Kumar

Aman Kumar

Updated on 20-May-2025 18:49:03

3K+ Views

Array Class In C++, the array class is part of the standard library and is known for its fixed size. The C++ array class, introduced in C++11, offers a better alternative to C-style arrays. The following are the advantages of the array class over a C-style array: ... Read More

C++ Program to find the median of two sorted arrays using binary search approach

Aman Kumar

Aman Kumar

Updated on 20-May-2025 18:47:53

212 Views

The median is defined as the middle value of a sorted list of numbers, and the middle value is found by ordering the numbers in ascending order. Once the numbers are ordered, the middle value is called the median of the given data set. Here, in this article, we have ... Read More

C++ Program to Implement Stack Using Two Queues

Aman Kumar

Aman Kumar

Updated on 16-May-2025 17:12:01

1K+ Views

Queue The queue is a linear data structure that follows the First-In-First-Out (FIFO) operation. Where insertions are done at one end (rear) and deletions are done from another end (front). The first element that is entered is deleted first. Following are the stack operations: EnQueue ... Read More

fork() to execute processes from bottom to up using wait() in C++

Aman Kumar

Aman Kumar

Updated on 15-May-2025 15:48:14

2K+ Views

The fork() system call is used to create a process commonly known as a child process if the fork() returns 0. Otherwise, the created process is known as the parent process. All processes created with fork() execute in parallel. But what if we want the last process to be executed ... Read More

Advertisements