https://github.com/samyam81/adapter_design
Adapter design pattern allows incompatible interfaces to work together by providing a wrapper that translates the interface of a class into another interface that a client expect.
https://github.com/samyam81/adapter_design
adapter cpp csharp design design-patterns java kotlin python
Last synced: 7 months ago
JSON representation
Adapter design pattern allows incompatible interfaces to work together by providing a wrapper that translates the interface of a class into another interface that a client expect.
- Host: GitHub
- URL: https://github.com/samyam81/adapter_design
- Owner: samyam81
- Created: 2024-01-29T10:17:00.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-26T07:30:05.000Z (almost 2 years ago)
- Last Synced: 2025-04-08T04:51:12.315Z (about 1 year ago)
- Topics: adapter, cpp, csharp, design, design-patterns, java, kotlin, python
- Language: C#
- Homepage:
- Size: 19.5 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Adapter Design Pattern
This repository contains implementations of the Adapter design pattern in various programming languages. The Adapter pattern allows objects with incompatible interfaces to collaborate by converting the interface of one object into another interface that a client expects.
## Files
### Kotlin
- **Main.kt**: Contains the main function to demonstrate the usage of the Adapter pattern.
- **AssignmentWork.kt**: Defines the `AssignmentWork` class which uses a `PenAdapter` to write assignments.
- **Pen.kt**: Defines the `Pen` interface.
- **PenAdapter.kt**: Implements the `Pen` interface by adapting `PilotPen` to write assignments.
### Java
- **AssignmentWork.java**: Defines the `AssignmentWork` class which uses a `PenAdapter` to write assignments.
- **Pen.java**: Defines the `Pen` interface.
- **PenAdapter.java**: Implements the `Pen` interface by adapting `PilotPen` to write assignments.
- **PilotPen.java**: Provides the implementation for writing using a Pilot Pen.
- **School.java**: Contains the main function to demonstrate the usage of the Adapter pattern.
### C++
- **Main.cpp**: Contains the main function to demonstrate the usage of the Adapter pattern.
- **AssignmentWork.cpp**: Defines the `AssignmentWork` class which uses a `PenAdapter` to write assignments.
- **Pen.h**: Defines the `Pen` abstract class.
- **PilotPen.h**: Provides the implementation for writing using a Pilot Pen.
- **PenAdapter.cpp**: Implements the `Pen` interface by adapting `PilotPen` to write assignments.
### C#
- **School.cs**: Contains the main function to demonstrate the usage of the Adapter pattern.
- **AssignmentWork.cs**: Defines the `AssignmentWork` class which uses a `PenAdapter` to write assignments.
- **IPen.cs**: Defines the `IPen` interface.
- **PenAdapter.cs**: Implements the `IPen` interface by adapting `PilotPen` to write assignments.
- **PilotPen.cs**: Provides the implementation for writing using a Pilot Pen.
### Python
- **main.py**: Contains the main function to demonstrate the usage of the Adapter pattern.
- **pen.py**: Defines the `Pen` interface.
- **pilot_pen.py**: Provides the implementation for writing using a Pilot Pen.
- **pen_adapter.py**: Implements the `Pen` interface by adapting `PilotPen` to write assignments.
- **assignment_work.py**: Defines the `AssignmentWork` class which uses a `PenAdapter` to write assignments.
## Usage
Each implementation demonstrates how the Adapter pattern can be used to make two incompatible interfaces work together seamlessly. Simply run the main function in each respective language file to see the demonstration.
## Contributors
- [Samyam](https://github.com/samyam81) and
- [Swikriti](https://github.com/swikriti0416)