This commit is contained in:
Сергей Маринкевич
2025-07-23 15:51:27 +07:00
parent f994303cb5
commit d17c80a195
9 changed files with 85 additions and 57 deletions
+4 -7
View File
@@ -3,18 +3,15 @@
#include "ifaces/INode.h"
#include <iostream>
class BaseNode : public INode,
public LazyLinkMixin<OneToManyLink>,
public std::enable_shared_from_this<INode> {
class BaseNode : public virtual INode {
public:
BaseNode(std::string name) : name_(std::move(name)) {}
BaseNode(std::string name) : name_(std::move(name)) {
std::cout << "--- Base constructor called for: " << name_ << "\n";
}
const std::string& name() const override { return name_; }
~BaseNode() {
std::cout << "--- Base destructor called for: " << name_ << "\n";
}
protected:
NodePtr getNode() override {
return shared_from_this();
}
std::string name_;
};
+5 -2
View File
@@ -2,10 +2,13 @@
#include "nodes/BaseNode.h"
#include <iostream>
class SimpleNode : public BaseNode {
class SimpleNode : public BaseNode,
public LazyLinkMixin<OneToManyLink> {
public:
~SimpleNode() {
std::cout << "--- Simple destructor called for: " << name_ << "\n";
}
SimpleNode(std::string name) : BaseNode(std::move(name)) {}
SimpleNode(std::string name) : BaseNode(std::move(name)) {
std::cout << "--- Simple constructor called for: " << name_ << "\n";
}
};