MCPcopy Create free account
hub / github.com/Tencent/rapidjson / Dependent

Class Dependent

example/serialize/serialize.cpp:72–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70};
71
72class Dependent : public Person {
73public:
74 Dependent(const std::string& name, unsigned age, Education* education = 0) : Person(name, age), education_(education) {}
75 Dependent(const Dependent& rhs) : Person(rhs), education_(0) { education_ = (rhs.education_ == 0) ? 0 : new Education(*rhs.education_); }
76 virtual ~Dependent();
77
78 Dependent& operator=(const Dependent& rhs) {
79 if (this == &rhs)
80 return *this;
81 delete education_;
82 education_ = (rhs.education_ == 0) ? 0 : new Education(*rhs.education_);
83 return *this;
84 }
85
86 template <typename Writer>
87 void Serialize(Writer& writer) const {
88 writer.StartObject();
89
90 Person::Serialize(writer);
91
92 writer.String("education");
93 if (education_)
94 education_->Serialize(writer);
95 else
96 writer.Null();
97
98 writer.EndObject();
99 }
100
101private:
102
103 Education *education_;
104};
105
106Dependent::~Dependent() {
107 delete education_;

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected