Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/miloyip/rapidjson.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilo Yip <miloyip@gmail.com>2014-07-02 20:59:35 +0400
committerMilo Yip <miloyip@gmail.com>2014-07-02 20:59:35 +0400
commit5a186104f4b9b5f223d4fc997c92f856539df276 (patch)
tree8581732ee4e65200223ac81c2bff09844907e89c /example
parent5852c42bb9d407fe5ed6e5a94d59d4487bb84da4 (diff)
Fixes warnings
Diffstat (limited to 'example')
-rw-r--r--example/serialize/serialize.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/example/serialize/serialize.cpp b/example/serialize/serialize.cpp
index efee58fb..6dfe2d48 100644
--- a/example/serialize/serialize.cpp
+++ b/example/serialize/serialize.cpp
@@ -58,9 +58,17 @@ private:
class Dependent : public Person {
public:
Dependent(const std::string& name, unsigned age, Education* education = 0) : Person(name, age), education_(education) {}
- Dependent(const Dependent& rhs) : Person(rhs) { education_ = (rhs.education_ == 0) ? 0 : new Education(*rhs.education_); }
+ Dependent(const Dependent& rhs) : Person(rhs), education_(0) { education_ = (rhs.education_ == 0) ? 0 : new Education(*rhs.education_); }
virtual ~Dependent();
+ Dependent& operator=(const Dependent& rhs) {
+ if (this == &rhs)
+ return *this;
+ delete education_;
+ education_ = (rhs.education_ == 0) ? 0 : new Education(*rhs.education_);
+ return *this;
+ }
+
template <typename Writer>
void Serialize(Writer& writer) const {
writer.StartObject();
@@ -77,6 +85,7 @@ public:
}
private:
+
Education *education_;
};
@@ -86,7 +95,7 @@ Dependent::~Dependent() {
class Employee : public Person {
public:
- Employee(const std::string& name, unsigned age, bool married) : Person(name, age), married_(married) {}
+ Employee(const std::string& name, unsigned age, bool married) : Person(name, age), dependents_(), married_(married) {}
virtual ~Employee();
void AddDependent(const Dependent& dependent) {