summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAdam <adamwheins@gmail.com>2015-05-31 21:38:03 -0400
committerAdam <adamwheins@gmail.com>2015-05-31 21:38:03 -0400
commit462ac892179d64437b1124263402378a6054e50b (patch)
treedcd63e7bf0c53c8a469f3d80535e19d84c39f4cf
parent8dba840cfe3404a3e718b3b57f6874d577360d38 (diff)
Remove return type from Dog class constructor and destructor, change nonexistant printDog function to print.
-rw-r--r--c++.html.markdown6
1 files changed, 3 insertions, 3 deletions
diff --git a/c++.html.markdown b/c++.html.markdown
index 9f8f5f32..2c6d51a9 100644
--- a/c++.html.markdown
+++ b/c++.html.markdown
@@ -300,7 +300,7 @@ public:
}; // A semicolon must follow the class definition.
// Class member functions are usually implemented in .cpp files.
-void Dog::Dog()
+Dog::Dog()
{
std::cout << "A dog has been constructed\n";
}
@@ -323,7 +323,7 @@ void Dog::print() const
std::cout << "Dog is " << name << " and weighs " << weight << "kg\n";
}
-void Dog::~Dog()
+Dog::~Dog()
{
cout << "Goodbye " << name << "\n";
}
@@ -332,7 +332,7 @@ int main() {
Dog myDog; // prints "A dog has been constructed"
myDog.setName("Barkley");
myDog.setWeight(10);
- myDog.printDog(); // prints "Dog is Barkley and weighs 10 kg"
+ myDog.print(); // prints "Dog is Barkley and weighs 10 kg"
return 0;
} // prints "Goodbye Barkley"