d04 ex02 ok, presque rien a changer ou je me trompe ?

This commit is contained in:
hugogogo
2022-02-26 22:12:55 +01:00
parent ed2bbc7fd2
commit c056db80b7
27 changed files with 597 additions and 68 deletions

View File

@@ -28,14 +28,14 @@ LIBS =
INCLUDES = -I$(D_HEADERS)
D_SRCS = .
D_SRCS = srcs
SRCS = main.cpp \
Animal.cpp \
Dog.cpp \
Cat.cpp \
Brain.cpp
D_HEADERS = .
D_HEADERS = headers
HEADERS = Animal.hpp \
Dog.hpp \
Cat.hpp \

Binary file not shown.

Binary file not shown.

View File

@@ -1,43 +0,0 @@
#include <iostream>
class A {
public:
A & operator=( A const & rhs ) {
std::cout << "A assignation operator\n";
_i = rhs._i;
return *this;}
private:
int _i;
};
class B {
public:
B() {
std::cout << "B default constructor\n";
_a = new A();}
B( A *a ) {
std::cout << "B parameterized constructor\n";
_a = new A();
*_a = *a;}
~B() {
std::cout << "B destructor\n";
delete _a;}
private:
A *_a;
};
int main() {
{
const B * b = new B();
delete b;
}
std::cout << "\n";
{
B * b;
A * a = new A();
b = new B(a);
delete a;
delete b;
}
return 0;
}