https://github.com/cypri1-dev/42_cpp03
This project involves creating a robot hierarchy in C++ starting with the ClapTrap class, with basic attributes (name, hit points, energy, damage) and methods for attacking, repairing, and taking damage. The derived classes ScavTrap, FragTrap, and DiamondTrap add unique abilities, showcasing inheritance and composition in C++.
https://github.com/cypri1-dev/42_cpp03
42 42projects cpp cpp03
Last synced: 6 months ago
JSON representation
This project involves creating a robot hierarchy in C++ starting with the ClapTrap class, with basic attributes (name, hit points, energy, damage) and methods for attacking, repairing, and taking damage. The derived classes ScavTrap, FragTrap, and DiamondTrap add unique abilities, showcasing inheritance and composition in C++.
- Host: GitHub
- URL: https://github.com/cypri1-dev/42_cpp03
- Owner: cypri1-dev
- Created: 2024-10-29T12:49:12.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-08T16:06:24.000Z (about 1 year ago)
- Last Synced: 2025-04-05T07:26:44.403Z (9 months ago)
- Topics: 42, 42projects, cpp, cpp03
- Language: C++
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
##
## Description
This project involves creating a robot hierarchy in C++ starting with the `ClapTrap` class, with basic attributes (name, hit points, energy, damage) and methods for attacking, repairing, and taking damage. The derived classes `ScavTrap`, `FragTrap`, and `DiamondTrap` add unique abilities, showcasing inheritance and composition in C++.
## Exercise 00
Objectives ๐:
- Implement the foundational `ClapTrap` class.
Requirements:
- Create `ClapTrap` with attributes: `Name` (from constructor), `Hit Points` (10), `Energy Points` (10), and `Attack Damage` (0).
- Methods: `attack(const std::string& target)`, `takeDamage(unsigned int amount)`, and `beRepaired(unsigned int amount)`.
## Exercise 01
Objectives ๐:
- Introduce a derived class `ScavTrap` with unique attributes and behaviors.
Requirements:
- Inherit `ClapTrap`, updating initial values to `Hit Points` (100), `Energy Points` (50), `Attack Damage` (20).
- Add `guardGate()` for Gate Keeper mode.
## Exercise 02
Objectives ๐:
- Introduce a derived class `FragTrap` with unique attributes and behaviors.
Requirements:
- Inherit `ClapTrap`, updating initial values to `Hit Points` (100), `Energy Points` (100), `Attack Damage` (30).
- Add `guardGate()` for Gate Keeper mode.
## Exercise 03
Objectives ๐:
- Create a hybrid `DiamondTrap` class combining `ScavTrap` and `FragTrap` traits.
Requirements:
- Inherit both `FragTrap` and `ScavTrap`, setting `Name`, `Hit Points`, `Energy Points`, and `Attack Damage` accordingly.
- Add a `whoAmI()` method to display `DiamondTrapโs` identity and `ClapTrap`-style name.