In C++, dynamic casting is a type of casting that allows you to perform runtime type checking and safely convert pointers or references of a base class to pointers or references of a derived class. It is primarily used in Read More …
Author:
Static Casting
In C++, static casting is a way to explicitly convert one data type to another. It is a compile-time cast that can be used when there is a known relationship between the source and target types. Static casting allows conversions Read More …
Object Slicing
In C++, object slicing refers to a situation where you assign an object of a derived class to an object of its base class, resulting in the loss of derived class-specific information. This occurs when you assign or pass an Read More …
Virtual Base Class.
In C++, a virtual base class is a base class that is designed to be shared among multiple derived classes in a class hierarchy. It is used to avoid the “diamond problem” that can occur when multiple inheritance is used. Read More …
Diamond problems
In C++, a diamond problem occurs when a class inherits from two or more classes that have a common base class. This can lead to ambiguity and conflicts in the derived class due to multiple inheritance paths. To illustrate this, Read More …
Deep Copy and Shallow Copy
In C++, deep copy and shallow copy are two different approaches to copying objects. Shallow Copy: A shallow copy creates a new object and copies the values of the members from the original object to the new object. If the Read More …
Why copy constructor use pass by reference only not pointer?
In C++, when designing a copy constructor, it is common to pass the argument by reference rather than by pointer. This is because passing by reference allows for cleaner syntax and avoids unnecessary null pointer checks. Additionally, passing by reference Read More …
What is Interface Class?
In C++, an interface class is a class that defines a contract or a set of pure virtual functions without any member variables. It serves as a blueprint for other classes to inherit from and implement the required functionality. An Read More …
What is Abstract Class?
In C++, an abstract class is a class that cannot be instantiated directly, meaning you cannot create objects of that class. It is designed to serve as a base class for other classes and defines a common interface that its Read More …
What is Pure virtual functions?
In C++, a pure virtual function is a function that has no implementation within the base class. It is declared using the “virtual” keyword followed by “= 0” in its declaration. The purpose of a pure virtual function is to Read More …