8000
Skip to content

Dharma-DX/OOPsConcept

Repository files navigation

Object-Oriented Programming (OOP) Concepts in C#

This repository contains explanations of various Object-Oriented Programming (OOP) concepts in C#. Each concept is described to help you understand and apply them in your projects.

Table of Contents

  1. Encapsulation
  2. Inheritance
    • Single Inheritance
    • Multilevel Inheritance
    • Hierarchical Inheritance
    • Hybrid Inheritance
  3. Polymorphism
    • Compile-Time Polymorphism
    • Run-Time Polymorphism
  4. Abstraction

Encapsulation

Encapsulation is the concept of wrapping data and methods that operate on the data within a single unit, typically a class. It restricts direct access to some of the object's components, which can prevent the accidental modification of data.

Inheritance

Inheritance allows a class to inherit properties and methods from another class. It promotes code reusability and establishes a natural hierarchy between classes.

Types of Inheritance:

Single Inheritance

A class inherits from one base class.

Multilevel Inheritance

A class is derived from a class which is also derived from another class.

Hierarchical Inheritance

Multiple classes inherit from a single base class.

Hybrid Inheritance

A combination of two or more types of inheritance (achieved using interfaces in C#).

Polymorphism

Polymorphism allows methods to do different things based on the object it is acting upon, even though they share the same name. It can be achieved through method overriding and method overloading.

Types of Polymorphism:

Compile-Time Polymorphism (Method Overloading)

Achieved through method overloading and operator overloading.

Run-Time Polymorphism (Method Overriding)

Achieved through method overriding using inheritance.

Abstraction

Abstraction is the concept of hiding the complex implementation details and showing only the necessary features of an object. It can be achieved using abstract classes and interfaces.

About

OOPConcepts This repository provides detailed explanations and examples of Object-Oriented Programming (OOP) concepts and design principles in C#. It covers Encapsulation, Inheritance, Polymorphism, and Abstraction, along with various types of inheritance and polymorphism, to help developers apply these concepts in their projects.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

0