oops-basics

Inheritance in Object Oriented Programming (Java) Cover Image
Inheritance in Object Oriented Programming (Java)

Inheritance is one of the core principles of object-oriented programming (OOP), which help us derive a class from another class or a hierarchy of classes that share a set of attributes and methods. In other words, it is a relationship between a superclass (a more generalised class) and a subclass (a more specialised class), where the subclass inherits data and behavior from the superclass.

Abstract Class in Java (OOP) Cover Image
Abstract Class in Java (OOP)

In Java, abstraction is implemented using abstract class and interface, which are two categories in Java with different rules and properties. An abstract class appears similar to any other class, but it is declared with the abstract keyword, and one can never instantiate an abstract class.

Object Oriented Programming (OOPS) Concepts in Java Cover Image
Object Oriented Programming (OOPS) Concepts in Java

Learning Object-Oriented Programming is essential for modern software development as it introduces many features such as Inheritance, Encapsulation, Abstraction, and Polymorphism. Besides reducing code complexity, the oops provide other advantages like code modularity, code reusability, code extensibility, data hiding, etc.

Interface in Java (OOP) Cover Image
Interface in Java (OOP)

The word “interface” means a medium or means of communication between two entities. Similarly, in Java, interfaces are used to ease the communication between various classes. An interface looks similar to any class and contains only constants, method signatures, default methods, and static methods.

Compile-time vs. Runtime polymorphism in Java Cover Image
Compile-time vs. Runtime polymorphism in Java

In OOP, Polymorphism allows us to code to an interface and has multiple implementations, making the program better. In Java, there are two types of polymorphism: Compile-time and Runtime polymorphism. The first type is implemented with method overloading, and the second one is implemented via method overriding.

Difference Between Class and Structure in C++ Cover Image
Difference Between Class and Structure in C++

In C++, there are a few differences between structure and class based on their definition and use cases. One major difference is that the structure members and base classes are public by default, and the members and base classes of a class are private by default.

Operator Overloading in C++ Cover Image
Operator Overloading in C++

Operator overloading is a compile-time polymorphism in C++ that allows us to make operators work for user-defined data types as objects and structures. In other words, we can extend the meaning of an operator to operate on a user-defined data type.

Method Overloading in OOPS (Java) Cover Image
Method Overloading in OOPS (Java)

Java language has a feature called method overloading, which allows multiple methods within a class to have the same name with different argument lists. It is a type of polymorphism (the process by which we can perform a single task in various ways). To be more concise, overloading is an example of static polymorphism.

Introduction to Constructors in Java Cover Image
Introduction to Constructors in Java

In oops, we may want our object to get initialized with some specific properties, or we may need to do some operations every time an object is instantiated. To do such things, we use constructors. In simple words, a constructor is defined inside the class that contains the code to instantiate the class object.

Classes and Objets in Object Oriented Programming (OOP) Cover Image
Classes and Objets in Object Oriented Programming (OOP)

A class is a user-defined blueprint that describes what a specific kind of object will look like, but an object is an instance of a class, which contains data and methods working on that data. In simple words, classes and objects are the fundamental building blocks of Object-Oriented Programming (OOPS).

Abstraction in Object Oriented Programming (OOPS) Cover Image
Abstraction in Object Oriented Programming (OOPS)

In OOPS, Abstraction exposes necessary functionality to external objects and hides implementation details. This helps programmers to use complex logic without understanding its implementation. In other words, Abstraction is a process of exposing relevant functionalities so that one needs to know what the code does, not how it does it.

Encapsulation in Object Oriented Programming (OOPS) Cover Image
Encapsulation in Object Oriented Programming (OOPS)

Encapsulation is one of the fundamental concepts in OOP that bundles data and associated methods that operate on that data into a single block called class. It is also a pathway for restricting direct access to some data and methods associated with a class (which leads to data hiding).

Object Oriented Programming (OOPS) Concepts in C++ Cover Image
Object Oriented Programming (OOPS) Concepts in C++

Object-Oriented Programming binds together the data and the methods in the form of an object and selectively exposes the data to other objects. It primarily revolves around classes and objects, i.e., their definition, instantiation, relationship, communication, etc. It helps us to organize code and development processes for large-scale software.

Principles of Object-Oriented Programming (OOP) Cover Image
Principles of Object-Oriented Programming (OOP)

Learn the four pillars of object-oriented programming: Abstraction, Encapsulation, Inheritance, and Polymorphism.

Important C++ Concepts in Programming Cover Image
Important C++ Concepts in Programming

This blog has discussed critical C++ concepts related to dangling pointers, bad pointers, memory leak, static memory, dynamic memory, reference variable, const and volatile keywords, template, etc.

Our weekly newsletter

Subscribe to get weekly content on data structure and algorithms, machine learning, system design and oops.

© 2022 Code Algorithms Pvt. Ltd.

All rights reserved.