Add copy constructors. Make example working.
[genetic.git] / src / gene.h
index 499ca80643a9f5a428ae167321fa5d2089af67ac..618f88723f1d4cf8a152d964441d8ea8d46e2e98 100644 (file)
@@ -6,14 +6,23 @@ namespace genetic {
     template < typename Type >
     class Gene {
     protected:
-        Type fenotype;
+        Type value;
     public:
-        Gene(Type fenotype) {
-            this->fenotype = fenotype;
+        Gene() {}
+
+        Gene(Type value) {
+            this->value = value;
+        }
+
+        /** Copy constructor */
+        Gene(const Gene& gene) : value(gene.get()) {}
+
+        Gene& operator=(const Gene&){
+            return *this;
         }
 
-        Type get() {
-            return this->fenotype;
+        Type get() const {
+            return value;
         }
     };
 }