Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tanner-davison/overloaded-classes-by_tanner_davison
Demonstrates object-oriented programming concepts such as dynamic memory management, copy constructors, assignment operators, and the creation of custom data structures like an ArrayList. The ArrayList class manages a dynamically allocated array of characters
https://github.com/tanner-davison/overloaded-classes-by_tanner_davison
c cpp dynamic-memory-management
Last synced: 2 months ago
JSON representation
Demonstrates object-oriented programming concepts such as dynamic memory management, copy constructors, assignment operators, and the creation of custom data structures like an ArrayList. The ArrayList class manages a dynamically allocated array of characters
- Host: GitHub
- URL: https://github.com/tanner-davison/overloaded-classes-by_tanner_davison
- Owner: Tanner-Davison
- Created: 2024-08-08T05:59:55.000Z (5 months ago)
- Default Branch: master
- Last Pushed: 2024-10-07T05:32:49.000Z (3 months ago)
- Last Synced: 2024-10-09T17:14:22.541Z (2 months ago)
- Topics: c, cpp, dynamic-memory-management
- Language: Makefile
- Homepage:
- Size: 109 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Project Name: **Overloaded-Classes-by_Tanner_Davison**
### Description
**Overloeaded-Classes** is a C++ project that demonstrates object-oriented programming concepts such as dynamic memory management, copy constructors, assignment operators, and the creation of custom data structures like an `ArrayList`. The `ArrayList` class manages a dynamically allocated array of characters, providing basic operations such as printing the list and copying data between instances.### Features
- **Dynamic Memory Management**: The `ArrayList` class dynamically allocates memory for an array of characters and ensures proper memory management with destructors.
- **Copy Constructor**: Safely creates a copy of an `ArrayList` object, duplicating the contents of the original list.
- **Copy Assignment Operator**: Handles assigning one `ArrayList` object to another, ensuring deep copying of the array contents.
- **List Printing**: A method to print the contents of the list to the console.### Example Usage
1. **Create an `ArrayList` Instance**:
```cpp
ArrayList myList(10); // Create an ArrayList with a length of 10
```2. **Print the List**:
```cpp
myList.printList(); // Outputs the current contents of the list (initially empty/zeroed)
```3. **Copy the `ArrayList` Using the Copy Constructor**:
```cpp
ArrayList copiedList(myList); // Create a new ArrayList as a copy of myList
copiedList.printList(); // Outputs the copied list contents
```4. **Assign One `ArrayList` to Another**:
```cpp
ArrayList anotherList(5); // Create another ArrayList with a length of 5
anotherList = myList; // Assign the contents of myList to anotherList
anotherList.printList(); // Outputs the updated contents of anotherList
```### Compilation and Execution
To compile and run this project, use a C++ compiler such as g++:```sh
g++ -o entity_arraylist entity_arraylist.cpp
./main