๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ java โ€บ understanding-encapsulation-inheritance-polymorphism-abstraction-in-oops
Understanding Encapsulation, Inheritance, Polymorphism, Abstraction in OOPs - GeeksforGeeks
July 15, 2025 - The core idea behind this concept is also polymorphism. The idea is that the object of the bird can have the value of the pigeon because it inheriting the features of the bird. Therefore, a parent object can also be initialized with the child properties if both the objects extend each other in the following way: ... Abstraction in general means hiding.
๐ŸŒ
Khalil Stemmler
khalilstemmler.com โ€บ articles โ€บ object-oriented โ€บ programming โ€บ 4-principles
4 Principles of Object-Oriented Programming | Khalil Stemmler
May 31, 2022 - Abstraction lets us selectively focus on the high-level and abstract way the low-level details. Inheritance is about code reuse, not hierarchies. Encapsulation keeps state private so that we can better enforce business rules, protect model ...
Discussions

what is encapsulation, inheritance, and polymorphism?
class Foo { public: int length(); private: int begin; int end; }; begin and end are encapsulated. class Bar : public Foo { public: int min(); int max(); }; Bar inherits from Foo. int squareLength(Foo& foo) { int length = foo.length(); return length*length; } Bar bar; int baz = squareLength(bar); bar is passed to squareLength polymorphic. More on reddit.com
๐ŸŒ r/cpp_questions
14
2
April 4, 2021
ELI5: The 4 major principles of Object Oriented Programming: Encapsulation, Abstraction, Inheritance, Polymorphism.
Encapsulate: to hide as if in a capsule. You hide direct access to your data and you hide how you are manipulating that data Abstraction: To exist as an idea instead of physically. You code what your program is able to do without actuay doing it. Then people can come in and implement it using your abstract definition. Inheritance: To gain something from someone else. One piece of code can gain the traits and behaviors of another piece of code without duplicating the code Polymorphism: Poly is many. Morphism is changing. Specifically, changing from one type of data to another. Or, having one type of data act like another.Think of inheritance. If object A inherits from B. Then any piece of code that takes a "B" object can also take an "A" object. Because all traits and behaviors of B are available in A. I can give examples if you want. My favorite example topic is pokemon. More on reddit.com
๐ŸŒ r/explainlikeimfive
18
125
May 20, 2016
What's the deal with abstraction and polymorphism in python?
They're abstract concepts that apply to every programming language. Read up on them in a different programming language and just modify examples for python as needed, or any target language. More on reddit.com
๐ŸŒ r/learnpython
15
13
May 16, 2024
ELI5: OOP: Inheritance, encapsulation, abstraction and polymorphism. Using animals as examples.

Inheritance is much like evolution. Different breeds of dog all come from the same wolf-like ancestor. They inherit their properties (fields, like number of legs or the presence of fur), and behaviours (barking, eating). Sometimes a particular breed of dog can extend the archetype it inherits from, such as the property of having curly hair (poodles) or the behaviour of sniffing things out on command (bloodhound). However, if a dog breed loses the ability to perform some specific action of its ancestor, it breaks the Liskov Substitution Principle, and is regarded as a badly designed breed.

Encapsulation is the business of tying related behaviours and state together, and not exposing the internals to the outside world. I can't think of an animal metaphor, but a good example is a microwave. How do you operate a microwave oven? Do you open up the case, attach some wires and apply voltages to certain pins? Of course not: you'd have to know lots about the design of the microwave (meaning learning it over and over again for each new oven), and as an outsider, you might mess things up or leave the microwave in a contradictory state (you turned the grill off but kept the light on). No, you interact with the microwave via an interface. It provides a simple mechanism that only requires you to know the high level details of what you want. With an interface, the innards of a microwave can be upgraded without causing problems for wannabe microwave chefs - so long as the contract of the interface is maintained, you will keep being able to use the same old commands as before. This wouldn't have been possible without encapsulation.

Abstraction is usually used to mean classes that are only implemented by their children. Thing of the wolf-dog ancestor: it's extinct, but its properties and behaviours are still manifested in modern instances of everyday dogs, and those dogs still inherit from their parent, even though no real wolf-dog lives in the world today.

Polymorphism is about properties and particularly behaviours being overridden. So think of how a poodle's yap overrides the wolf-dog's bark. The poodle has a special case of the greater bark() method. This allows us to specify and switch different kind of dogs forndiffereent purposes, but still use the same interface with them.

I'd wrote more, but I'm typing on a phone. Good luck with your learning - I'm in a similar boat to yourself!

More on reddit.com
๐ŸŒ r/explainlikeimfive
2
1
February 9, 2014
People also ask

What is encapsulation in Java
divIn Java encapsulation is an approach that blocks direct access to an objects internal state and groups data attributes and methods functions that manipulate the data into a single unit called a class giving the user control over data access and changedivdivbrdiv
๐ŸŒ
scholarhat.com
scholarhat.com โ€บ home โ€บ tutorials โ€บ java โ€บ oops concepts in java: en..
OOPs Concepts in Java: Encapsulation, Abstraction, Inheritance, ...
What is an abstraction in OOP
divIn objectoriented programming OOP abstraction is the process of decomposing large systems into their basic components while hiding additional informationdivdivbrdiv
๐ŸŒ
scholarhat.com
scholarhat.com โ€บ home โ€บ tutorials โ€บ java โ€บ oops concepts in java: en..
OOPs Concepts in Java: Encapsulation, Abstraction, Inheritance, ...
What is the full concept of OOP
divIn its complete form objectoriented programming OOP promotes concepts like inheritance polymorphism and abstraction for improved code structure and reusability by structuring software into objects that encompass both data and behaviordivdivbrdiv
๐ŸŒ
scholarhat.com
scholarhat.com โ€บ home โ€บ tutorials โ€บ java โ€บ oops concepts in java: en..
OOPs Concepts in Java: Encapsulation, Abstraction, Inheritance, ...
๐ŸŒ
BeginnersBook
beginnersbook.com โ€บ 2013 โ€บ 03 โ€บ oops-in-java-encapsulation-inheritance-polymorphism-abstraction
OOPs in Java: Encapsulation, Inheritance, Polymorphism, Abstraction
I read lot of theory regarding Abstraction and Encapsulation.However Still I am confusing myself. Could you please explain the difference between Abstraction and Encapsulation? ... UI is very attractive!Simple and Lucid language!Keep it going! ... abstraction concept means hiding, but it can be either full or partial ( hiding all or part of the data)
๐ŸŒ
Nerd
nerd.vision โ€บ post โ€บ polymorphism-encapsulation-data-abstraction-and-inheritance-in-object-oriented-programming
Polymorphism, Encapsulation, Data Abstraction and Inheritance in Object-Oriented Programming | nerd.vision
Instead, have one class and use ... Polymorphism allows program code to have different meaning or functions while encapsulation is the process of keeping classes private so they cannot be modified by external codes...
๐ŸŒ
Medium
medium.com โ€บ @thiscollid โ€บ understanding-the-pillars-of-oop-abstraction-encapsulation-inheritance-and-polymorphism-8bbe42e4be26
Understanding the Pillars of OOP: Abstraction, Encapsulation, Inheritance and Polymorphism | by Mohammad Taha Hashmi | Medium
May 13, 2024 - This unit controls the access to its data by hiding the internal state of an object from the outside world, and only exposes certain functionalities through well-defined interfaces. Encapsulation helps in achieving data hiding, abstraction, and modularization, making the code more maintainable and scalable.
๐ŸŒ
Medium
medium.com โ€บ @manishkumar_75473 โ€บ mastering-object-oriented-programming-oop-in-java-encapsulation-inheritance-polymorphism-and-12b5c5c4469c
Mastering Object-Oriented Programming (OOP) in Java: Encapsulation, Inheritance, Polymorphism, and Abstraction | by Manish Kumar | Medium
March 12, 2025 - Encapsulation helps in hiding the internal data of an object. Inheritance allows you to reuse code and create a hierarchy. Polymorphism provides flexibility by allowing objects to behave differently.
๐ŸŒ
ScholarHat
scholarhat.com โ€บ home โ€บ tutorials โ€บ java โ€บ oops concepts in java: en..
OOPs Concepts in Java: Encapsulation, Abstraction, Inheritance, Polymorphism
September 9, 2025 - The originator of OOP is often referred to as Alan Kay. In object-oriented programming (OOP), abstraction is the process of decomposing large systems into their basic components while hiding additional information.
Find elsewhere
๐ŸŒ
Medium
medium.com โ€บ @colebuildanddevelop โ€บ encapsulation-abstraction-inheritance-and-polymorphism-26aa98042d41
Encapsulation, Abstraction, Inheritance, and Polymorphism | by Cole Davis | Medium
September 13, 2020 - Others reading our code do not ... of our program through Abstraction. Encapsulation is the idea of hiding and restricting access to the implementation details of our objects....
๐ŸŒ
YouTube
youtube.com โ€บ watch
OOP 3 | Principles - Inheritance, Polymorphism, Encapsulation, Abstraction - YouTube
Important video for OOP interviews! The complete and in-depth explanation with real-world examples of #OOP principles such as Inheritance, Polymorphism, Enca...
Published: November 8, 2021
๐ŸŒ
Slideshare
slideshare.net โ€บ home โ€บ education โ€บ abstraction encapsulation inheritance polymorphism
Abstraction encapsulation inheritance polymorphism | PPTX
August 28, 2024 - It serves as a placeholder for a method that must be implemented in the subclasses or implementing classes. โ€ข Abstract methods are meant to be overridden by the subclasses to provide their own implementation. They define the contract or behavior that the subclasses must adhere to.
๐ŸŒ
Quora
quora.com โ€บ What-are-encapsulation-inheritance-polymorphism-and-abstraction
What are encapsulation, inheritance, polymorphism and abstraction? - Quora
Answer (1 of 3): They are the four pillars of Java. Encapsulation: In english, it means covering up things to make it secure . Similarly , in coding we do it by using classes and access modifiers(public,private, default, protected) . For an example : We have two class A and B. In class A ,we...
๐ŸŒ
Scribd
scribd.com โ€บ document โ€บ 435374968 โ€บ Concepts-of-Oop-3
OOP Concepts: Abstraction, Encapsulation, Inheritance, Polymorphism | PDF | Class (Computer Programming) | Method (Computer Programming)
Abstraction involves using objects and classes to represent complexity, encapsulation keeps data private and provides public access via methods, inheritance allows new classes to extend existing classes, and polymorphism enables the same word ...
๐ŸŒ
DEV Community
dev.to โ€บ rajrathod โ€บ mastering-object-oriented-programming-with-typescript-encapsulation-abstraction-inheritance-and-polymorphism-explained-c6p
Mastering Object-Oriented Programming with TypeScript: Encapsulation, Abstraction, Inheritance, and Polymorphism Explained - DEV Community
November 3, 2023 - Inheritance: Inheritance is a mechanism that enables a class (subclass) to inherit the properties and methods of another class (superclass). This promotes code reusability and hierarchical relationships between classes. Polymorphism: Polymorphism allows objects of different classes to be treated as objects of a common superclass...
๐ŸŒ
YouTube
youtube.com โ€บ code with josh
The Pillars of Object Oriented Programming: Encapsulation, Inheritance, Polymorphism and Abstraction - YouTube
In this comprehensive Python tutorial, you'll delve deep into the core concepts of object oriented programming (OOP). Discover the key principles of encapsul...
Published: February 8, 2024
Views: 792
๐ŸŒ
Berkeley
pythonnumericalmethods.studentorg.berkeley.edu โ€บ notebooks โ€บ chapter07.03-Inheritance-Encapsulation-and-Polymorphism.html
Inheritance, Encapsulation and Polymorphism โ€” Python Numerical Methods
Encapsulation can hide some of the private details of a class from other objects, while polymorphism can allow us to use a common operation in different ways. In this section, we will briefly discuss them. Inheritance allows us to define a class that inherits all the methods and attributes ...
๐ŸŒ
FusionReactor
fusion-reactor.com โ€บ home โ€บ why coldfusion monitoring, licensing, and consultancy should never be separate services โ€บ object-oriented programming; what is inheritance, polymorphism, abstraction & encapsulation?
Object-Oriented Programming; what is Inheritance, Polymorphism, Abstraction & Encapsulation?
June 3, 2020 - OOP has four major building blocks which are, Polymorphism, Encapsulation, Abstraction, and Inheritance. There are other programming paradigms such as Procedural programming in which codes are written in sequentially.
๐ŸŒ
Reddit
reddit.com โ€บ r/cpp_questions โ€บ what is encapsulation, inheritance, and polymorphism?
r/cpp_questions on Reddit: what is encapsulation, inheritance, and polymorphism?
April 4, 2021 -

I have a basic understanding of inheritance but the other two I donโ€™t understand. What is the purpose of there functionality and when would I use them?

Top answer
1 of 3
4
Encapsulation - At the core, this is just about hiding implementation details from the interface. In OOP, this usually means that you'd hide the state in private variables and only expose it as needed through friends and member functions. The pimpl idiom is another way of doing this. Modules provide yet another way, and impl or detail namespaces also help with encapsulation. To some extent, the traditional OOP methods for encapsulation through accessor/mutator functions is now considered to be bad practice (though I'd argue that in multiparadigm languages such as C++, it's always situational). Inheritance - basically, this is just code injection. It can be used for other purposes, but you should prefer composition over traditional OOP inheritance in most cases. Mixins, class template recursion, and CRTP are generally great ways to use inheritance. There are good reasons to use virtual inheritance and object-based design, but you should make absolutely sure it makes sense. I haven't needed to write virtual functions on years. Polymorphism - The general practice of being able to share the same code using multiple types. Virtual functions are an example of runtime polymorphism. Templates are an example of compile-time polymorphism. You should default to compile-time polymorphism where possible (for safety and performance reasons), and only use runtime polymorphism when needed. Other examples of polymorphism include: type punning/type erasure, std::any, std::optional, std::variant, 'auto', and more. As a side note, it sounds like you're learning OOP. While it's important to know and understand OOP, I just thought I should caution that OOP is not always the best way to go. Learning Data-oriented design and functional programming are definitely something you should explore as well.
2 of 3
2
class Foo { public: int length(); private: int begin; int end; }; begin and end are encapsulated. class Bar : public Foo { public: int min(); int max(); }; Bar inherits from Foo. int squareLength(Foo& foo) { int length = foo.length(); return length*length; } Bar bar; int baz = squareLength(bar); bar is passed to squareLength polymorphic.
๐ŸŒ
The IoT Academy
theiotacademy.co โ€บ home โ€บ what are the differences between polymorphism, encapsulation, and inheritance?
What are the differences between polymorphism, encapsulation, and inheritance? - Tech & Career Blogs
October 27, 2022 - Encapsulation is the practice of keeping classes secret so they cannot be changed by outside code, whereas polymorphism allows program code to have different meanings or functions.
๐ŸŒ
Reddit
reddit.com โ€บ r/explainlikeimfive โ€บ eli5: the 4 major principles of object oriented programming: encapsulation, abstraction, inheritance, polymorphism.
r/explainlikeimfive on Reddit: ELI5: The 4 major principles of Object Oriented Programming: Encapsulation, Abstraction, Inheritance, Polymorphism.
May 20, 2016 - You code what your program is able to do without actuay doing it. Then people can come in and implement it using your abstract definition. Inheritance: To gain something from someone else. One piece of code can gain the traits and behaviors of another piece of code without duplicating the code ยท Polymorphism: Poly is many.