coderz.py

Keep Coding Keep Cheering!

Virtual Destructors in C++

What is a Virtual Destructor? Deleting a derived class object with a non-virtual destructor using a pointer of the base class type results in undefined behavior. While deleting instances of the derived class using a base class pointer object, a virtual destructor is used to free up the memory space allocated by the derived class […]

October 28, 2022 | C++ | No comments

Virtual Functions in C++

A virtual function is a member function declared in a base class that is re-defined (overridden) by a derived class. When you use a pointer or a reference to the base class to refer to a derived class object, you can call a virtual function for that object and execute the derived class’s version of […]

October 26, 2022 | C++ | No comments

Method Overriding(Polymorphism)

What is Polymorphism? The term “polymorphism” refers to having multiple forms. Polymorphism is defined as the ability of a message to be displayed in more than one form. There are two types of polymorphism: Compile-time Polymorphism. Runtime Polymorphism. Method Overriding: Function overriding is a concept in C++ that allows us to define a function with the […]

October 26, 2022 | C++ | No comments

Upcasting in C++

Upcasting is the process of creating the derived class’s pointer or reference from the base class’s pointer or reference. It refers to the process of converting a derived class’s reference or pointer to a base class’s reference or pointer. Upcasting is a safer casting technique than downcasting. It supports public inheritance, which allows references to […]

October 26, 2022 | C++ | No comments

Order of Constructor Call in C++

If we inherit a class from another class and create an object of the derived class, it is obvious that the derived class’s default constructor will be invoked, but first, the default constructors of all base classes will be invoked. The data members and member functions of the base class are automatically included in the derived […]

October 23, 2022 | C++ | No comments

Types of Inheritance in C++

There are 5 types of Inheritance in C++: Single inheritance Multiple inheritance Hierarchical inheritance Multilevel inheritance Hybrid inheritance Single Inheritance: A class derives from only one base class in single inheritance. This means that there is only one subclass descended from a single superclass. Syntax: Example: Output: Multiple inheritance: Multiple inheritance is a type of […]

October 23, 2022 | C++ | No comments

Constructors and Destructors in C++

Constructor: A constructor is a special member function of a class and shares the same name as of class, which means the constructor and class have the same name. The compiler calls the constructor whenever a class object is created; it allocates memory to the object and initializes class data members with default values or […]

October 13, 2022 | C++ | No comments

Classes and Objects in C++

The fundamental idea that the object-oriented approach revolves around in C++ is the concept of classes and objects. It increases the efficiency of the program by reducing code redundancy and debugging time. Classes: A class is the building block in C++ that leads to Object-Oriented programming. It is a user-defined data type with its own […]

October 4, 2022 | C++ | No comments

OOPs Concepts in C++

Object-oriented programming (OOPs) is a programming approach or pattern in which programs are structured around objects rather than functions and logic. It partitions the data into two memory areas, namely data and functions, and aids in making the code flexible and modular. Concepts of an Object-Oriented Programming language: There are some basic concepts that act […]

September 20, 2022 | C++ | No comments

Serialization and Deserialization in Java

An object’s state can be transformed into a byte stream through a process known as serialization. Deserialization is the opposite procedure, in which the actual Java object is recreated in memory using a byte stream. This mechanism is used to persist the object. We use the writeObject() function of the ObjectOutputStream class to serialize the […]

July 16, 2022 | Java | No comments

Advertisement