Skip to content

Welcome to my C++ code repository showcasing various examples of Object-Oriented Programming (OOP) concepts.

Notifications You must be signed in to change notification settings

Mabdullahatif/Object_Oriented_Programming

Repository files navigation

Object-Oriented Programming in C++

Welcome to my C++ code repository showcasing various examples of Object-Oriented Programming (OOP) concepts. These programs cover essential OOP principles such as classes, objects, constructors, operator overloading, inheritance, encapsulation, dynamic memory allocation, and more. Each code example is designed to demonstrate specific OOP concepts using C++.

Table of Contents

Introduction

Object-oriented programming (OOP) is a popular programming paradigm that focuses on creating and modeling real-world entities as objects. These objects have attributes (data members) and behaviors (member functions) and are organized into classes. This repository contains various C++ code examples that illustrate OOP concepts and demonstrate how to implement them in practice.

Classes and Objects

  • Definition and implementation of classes.
  • Creation of objects and member variables.
  • Access specifiers (private and public) to control member accessibility.

Constructors and Destructors

  • Default constructor and parameterized constructor.
  • Copy constructor for object initialization.
  • Destructor to release memory resources.

Operator Overloading

  • Overloading arithmetic operators (+, -, *, /) to perform operations on custom objects.
  • Overloading comparison operators (>, ==) to compare objects.
  • Overloading prefix and postfix increment and decrement operators (++ and --) for custom behavior.

Friend Functions

  • Use of friend functions to allow non-member functions access to private members of a class.

Encapsulation

  • Encapsulation of data and behavior within class methods.
  • Data hiding and encapsulation of member variables using private access specifiers.

Member Functions

  • Definition and implementation of member functions to perform operations on objects.

Dynamic Memory Allocation

  • Usage of dynamic memory allocation (new/delete) to manage objects' memory.

Input/Output Operator Overloading

  • Overloading input and output stream operators (<< and >>) to enable custom input and output operations.

Conversion Functions

  • Creating conversion functions to convert Roman numerals to decimal numbers and vice versa.

Conditional Statements and Loops

  • Use of conditional statements (if-else) to perform specific actions based on conditions.
  • Use of loops (for, while) to iterate over strings and arrays.

C++ Standard Library

  • Utilization of standard library functions (e.g., strcpy, strlen, strcmp) for string manipulation.
  • Usage of standard library containers (e.g., string, ostream, istream) and algorithms.

How to Use

  1. Clone the repository to your local machine using git cloneor simply download .zip file.
  2. Navigate to the directory of the desired C++ file in your terminal.
  3. Compile the C++ file using a C++ compiler (e.g., g++). For example:
  4. Run the compiled executable to see the output of the program.

Contributing

Contributions to this repository are welcome! If you have any new C++ code examples or improvements to existing ones, feel free to create a pull request.

Initial Contributor

So far, all the work in this repository has been done by me.

Thank you for visiting this repository and happy coding!

LinkedIn             Facebook             Instagram             Twitter

                                                                                           

Releases

No releases published

Packages

No packages published

Languages