- 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.
30 lines
554 B
C++
30 lines
554 B
C++
#include "ClassA.h"
|
|
|
|
int main() {
|
|
ClassA a;
|
|
a.Print();
|
|
|
|
ClassA* pA = nullptr;
|
|
pA = new ClassA();
|
|
pA->Print();
|
|
// (*pA).Print(); // same as above, but more complex to write
|
|
delete pA;
|
|
pA = nullptr;
|
|
|
|
a.CompareTo(pA);
|
|
|
|
IComparable* pComparable = nullptr;
|
|
pComparable = new ClassA();
|
|
pComparable->CompareTo(&a);
|
|
// pA = dynamic_cast<ClassA *>(pComparable);
|
|
// if (pA != nullptr) {
|
|
// pA->Print();
|
|
// }
|
|
delete pComparable;
|
|
pComparable = nullptr;
|
|
|
|
ClassA a2 = a;
|
|
|
|
|
|
return 0;
|
|
} |