2025-08-21 17:29:26 -06:00
|
|
|
#include "B.h"
|
|
|
|
|
|
|
|
|
|
#include "A.h"
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
|
|
#if TEST_OBJECT_DATA
|
|
|
|
|
|
|
|
|
|
#include "BData.h"
|
|
|
|
|
|
|
|
|
|
B::B() {
|
2025-08-26 21:05:36 -06:00
|
|
|
printf("B() this=0x%x B.Id=%x\n", this, getId());
|
2025-08-21 17:29:26 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
B::B(const B& ref) : _data(ref._data) {
|
2025-08-26 21:05:36 -06:00
|
|
|
printf("B(B) this=0x%x B.Id=%x\n", this, getId());
|
2025-08-21 17:29:26 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
B::B(const A& a) : _data(new BData(a)) {
|
2025-08-26 21:05:36 -06:00
|
|
|
printf("B(A) this=0x%x B.Id=%x A.Id=%x\n", this, getId(), _data->_a.getId());
|
2025-08-21 17:29:26 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
B& B::operator = (const B& ref) {
|
|
|
|
|
_data = ref._data;
|
2025-08-26 21:05:36 -06:00
|
|
|
printf("=(B) this=0x%x B.Id=%x\n", this, getId());
|
2025-08-21 17:29:26 -06:00
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
A B::getA() {
|
2025-08-26 21:05:36 -06:00
|
|
|
printf("getA() this=0x%x B.Id=%x A.Id=%x\n", this, getId(), _data->_a.getId());
|
2025-08-21 17:29:26 -06:00
|
|
|
return _data->_a;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
long B::getId() {
|
|
|
|
|
return (long)_data.get();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#elif TEST_OBJECT_IMPL
|
|
|
|
|
|
|
|
|
|
#include "BImpl.h"
|
|
|
|
|
|
|
|
|
|
B::B() {
|
2025-08-26 21:05:36 -06:00
|
|
|
printf("B() this=0x%x B.Id=%x\n", this, getId());
|
2025-08-21 17:29:26 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
B::B(const B& ref) : _impl(ref._impl) {
|
2025-08-26 21:05:36 -06:00
|
|
|
printf("B(B) this=0x%x B.Id=%x\n", this, getId());
|
2025-08-21 17:29:26 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
B::B(const A& a) : _impl(new BImpl(a)) {
|
2025-08-26 21:05:36 -06:00
|
|
|
//printf("B(A) B.Id=%x A.Id=%x\n", getId(), _impl->_a.getId());
|
|
|
|
|
printf("B(A) this=0x%x B.Id=%x\n", this, getId());
|
2025-08-21 17:29:26 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
B& B::operator = (const B& ref) {
|
|
|
|
|
_impl = ref._impl;
|
2025-08-26 21:05:36 -06:00
|
|
|
printf("=(B) this=0x%x B.Id=%x\n", this, getId());
|
2025-08-21 17:29:26 -06:00
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
A B::getA() {
|
2025-08-26 21:05:36 -06:00
|
|
|
//printf("getA() B.Id=%x A.Id=%x\n", getId(), _impl->_a.getId());
|
|
|
|
|
printf("getA() this=0x%x B.Id=%x\n", this, getId());
|
2025-08-21 17:29:26 -06:00
|
|
|
return _impl->getA();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
long B::getId() {
|
|
|
|
|
return (long)_impl.get();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
B::B() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
B::B(const A& a) {
|
|
|
|
|
_a = a;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
A B::getA() {
|
|
|
|
|
return _a;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
long B::getId() {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|