coderz.py

Keep Coding Keep Cheering!

Method Overriding in Python

Method overriding is a feature of any object-oriented programming language that allows a subclass or child class to implement a method that is already provided by one of its super-classes or parent classes. When a method in a subclass has the same name, parameters or signature, and return type (or sub-type) as a method in […]

December 15, 2022 | python | No comments

Types of Inheritance in Python

Types of Inheritance depend upon the number of child and parent classes involved. There are four types of inheritance in Python: Single Inheritance Multiple Inheritance Multilevel Inheritance Hierarchical Inheritance Single Inheritance: Single inheritance allows for the inheritance of properties from a single parent class by a derived class, allowing for the reuse of existing code […]

December 12, 2022 | python | No comments

Inheritance in Python

Inheritance is a fundamental idea in object-oriented programming (OOP) languages. By deriving a class from another class, you can use this mechanism to build a hierarchy of classes that share a set of properties and methods. Benefits of inheritance include: It accurately depicts real-world relationships. It offers a code’s reusability. We don’t need to keep […]

December 12, 2022 | python | No comments

Object-Oriented Programming in Python

What Is Object-Oriented Programming? Alan Kay coined the term “Object-Oriented Programming” (OOP), also known as oops concepts in Python, in 1966 while in graduate school. Simula was the first programming language to include features of object-oriented programming. It was created in 1967 to create simulation programs in which the most important information was referred to […]

December 8, 2022 | python | No comments

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

Pure Virtual Functions and Abstract Classes

What are Pure Virtual Functions? A pure virtual function is a virtual function in C++ that does not require any function definition and is only declared. It is declared by assigning a value of 0 to the declaration. For instance, What is an Abstract Class? In C++, an abstract class has at least one pure […]

October 27, 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

Advertisement