diff options
author | Patrick Simianer <p@simianer.de> | 2014-06-14 16:46:27 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2014-06-14 16:46:27 +0200 |
commit | 26c490f404731d053a6205719b6246502c07b449 (patch) | |
tree | 3aa721098f1251dfbf2249ecd2736434c13b1d48 /ccc/animal.cc |
init
Diffstat (limited to 'ccc/animal.cc')
-rw-r--r-- | ccc/animal.cc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/ccc/animal.cc b/ccc/animal.cc new file mode 100644 index 0000000..3bad1b1 --- /dev/null +++ b/ccc/animal.cc @@ -0,0 +1,37 @@ +#include <iostream> + +using namespace std; + + +class Animal +{ + public: + Animal() { // Konstruktor + cout << "Der Konstruktor wird aufgerufen." << endl; + m_alive = true; + } + + ~Animal() {cout << "Der Destruktor wird aufgerufen." << endl;} + + bool isAlive() { // Methode + return m_alive; + } + + void kill() { // Methode + m_alive=false; + } + + private: + bool m_alive; // Member-Variable +}; + + +int main(void) +{ + int i; + bool alive; + + Animal a; // Instanz von Animal + Animal b; // noch eine ^ +} + |