Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • DSA
  • Practice Problems
  • C
  • C++
  • Java
  • Python
  • JavaScript
  • Data Science
  • Machine Learning
  • Courses
  • Linux
  • DevOps
  • SQL
  • Web Development
  • System Design
  • Aptitude
  • GfG Premium
Open In App
Next Article:
Object Oriented Programming(OOP) Tutorial
Next article icon

Object Oriented Programming(OOP) Tutorial

Last Updated : 30 May, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Object Oriented Programming (OOP) is a programming paradigm based on the concept of objects, which can contain data and code: data in the form of fields (often known as attributes or properties) and code in the form of procedures (often known as methods).

Object Oriented Programming (OOP) Tutorial with sections covering key concepts and examples in different popular programming languages: Python, Java, and C++.

OOP Concepts

Before diving into the languages, let's understand the core concepts of OOP:

  1. Class: A blueprint or template for creating objects. Defines attributes and behaviors.
  2. Object: An instance of a class. Each object has state (attributes) and behavior (methods).
  3. Encapsulation: Bundling data (attributes) and methods that operate on data within one unit (class), hiding internal state from outside.
  4. Inheritance: Mechanism where a new class derives properties and behaviors from an existing class.
  5. Polymorphism: Ability of different classes to be treated as instances of the same class through inheritance. It allows methods to do different things based on the object calling them.
  6. Abstraction: Hiding complex implementation details and showing only the necessary features.

OOP in different languages

  • OOP in Python
  • OOP in Java
  • OOP in C++
  • OOP in C#
  • OOP in JavaScript

Comparison of OOP in Different Languages

FeaturePythonJavaC++C#JavaScript
SyntaxSimple, dynamic typingStrict, static typingComplex, static typingClean, static typingFlexible, dynamic typing
Memory ManagementAutomatic (Garbage collection)Automatic (Garbage collection)Manual or automatic (RAII, smart pointers)Automatic (Garbage collection)Automatic (Garbage collection)
EncapsulationConvention via underscore/privateExplicit private/public/protectedExplicit private/public/protectedExplicit private/public/protectedVia closures and private fields (#)
PolymorphismSupported via method overridingSupported via overriding & interfacesSupported via virtual functionsSupported via virtual methods and interfacesSupported via prototype chaining and method overriding
InheritanceSingle and multiple inheritanceSingle inheritance, interfacesMultiple inheritance supportedSingle inheritance, multiple interfacesPrototype-based inheritance
AbstractionSupported via abstract base classes and interfaces (via ABC module)Supported via abstract classes and interfacesSupported via abstract classes and pure virtual functionsSupported via abstract classes and interfacesAchieved through prototypes and ES6 classes
Access ModifiersNo strict enforcement; convention only (_ or __)Strict enforcement (private, protected, public)Strict enforcement (private, protected, public)Strict enforcement (private, protected, internal, public)Limited; public by default, private via # or closure
Multiple InheritanceSupportedNot supported for classes; allowed via interfacesFully supportedNot supported for classes; allowed via interfacesNot supported; prototypal inheritance used instead
Method OverloadingNot natively supported; can be mimickedSupportedSupportedSupportedNot supported natively

Next Article
Object Oriented Programming(OOP) Tutorial

A

anuragtriarna
Improve
Article Tags :
  • Computer Subject

Similar Reads

    Java OOPs Coding Practice Problems
    Object-Oriented Programming (OOP) is a core concept in Java that enables code modularity, reusability, and scalability. This collection of Java OOPs coding practice problems covers essential topics like class design, constructors, encapsulation, inheritance, and abstraction. Whether you are a beginn
    2 min read
    Understanding Classes and Objects in Java
    The term Object-Oriented explains the concept of organizing the software as a combination of different types of objects that incorporate both data and behavior. Hence, Object-oriented programming(OOPs) is a programming model, that simplifies software development and maintenance by providing some rul
    10 min read
    Java OOP(Object Oriented Programming) Concepts
    Java Object-Oriented Programming (OOPs) is a fundamental concept in Java that every developer must understand. It allows developers to structure code using classes and objects, making it more modular, reusable, and scalable.The core idea of OOPs is to bind data and the functions that operate on it,
    13 min read
    A Step-by-Step Approach to Learn Object Oriented Programming
    Object-Oriented Programming or OOP's refers to the language that uses objects in programming. It is primarily concerned with the implementation of real-world entities such as inheritance, polymorphism, etc. in programming. For instance - in the class of Living Things; Humans, Animals, Plants, Microo
    5 min read
    Object Oriented Programming System (OOPs) For Kids
    Object-Oriented Programming System (OOPs) is a way of writing computer programs where we organize code into small, reusable pieces called objects. These objects represent things or concepts in the real world, like cars, animals, or people. Each object has its data and behaviors, and we can use them
    12 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences