Files
david f5e4caadf3 Add containers project with CMake setup and array-related functionality
- Implement `printArrayAtPosition` in `functions.cpp` with input validation.
- Created `main.cpp` to demonstrate array operations using C arrays and `std::vector`.
- Updated `ClassA` and `IComparable` with constructors, destructors, and deep copy logic.
- Adjusted IntelliJ project configuration for new containers module.
2026-02-20 16:24:24 +01:00

43 lines
830 B
C++

#include "ClassA.h"
#include <iostream>
ClassA::ClassA() : IComparable(), _number(0), _pDecimal(new float(0.0f))
{
std::cout << "ClassA created" << std::endl;
// _pDecimal = new float(0.0f);
}
ClassA::ClassA(const ClassA &other) :
IComparable(other),
_number(other._number),
_pDecimal(new float(*other._pDecimal))
{
std::cout << "ClassA copy created" << std::endl;
// shallow copy
// _number = other._number;
// _pDecimal = other._pDecimal;
// deep copy
// _number = other._number;
// _pDecimal = new float(*other._pDecimal);
}
ClassA::~ClassA() {
std::cout << "ClassA destroyed" << std::endl;
delete _pDecimal;
_pDecimal = nullptr;
}
void ClassA::Print()
{
std::cout << "ClassA" << std::endl;
}
int ClassA::CompareTo(IComparable *other) {
return 0;
}