From 258e1b92ebbfdebefabc120969ab87c3d8b75c3d Mon Sep 17 00:00:00 2001
From: Patrick Simianer
Date: Sun, 15 Jun 2014 03:50:12 +0200
Subject: old c,cc examples
---
c,cc/animal.cc | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 c,cc/animal.cc
(limited to 'c,cc/animal.cc')
diff --git a/c,cc/animal.cc b/c,cc/animal.cc
new file mode 100644
index 0000000..3bad1b1
--- /dev/null
+++ b/c,cc/animal.cc
@@ -0,0 +1,37 @@
+#include
+
+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 ^
+}
+
--
cgit v1.2.3