dlugolecki.net.pl
Dziennik
Polecane
Software
projects
/
genetic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add copy constructors. Make example working.
[genetic.git]
/
src
/
gene.h
diff --git
a/src/gene.h
b/src/gene.h
index 499ca80643a9f5a428ae167321fa5d2089af67ac..618f88723f1d4cf8a152d964441d8ea8d46e2e98 100644
(file)
--- a/
src/gene.h
+++ b/
src/gene.h
@@
-6,14
+6,23
@@
namespace genetic {
template < typename Type >
class Gene {
protected:
template < typename Type >
class Gene {
protected:
- Type
fenotyp
e;
+ Type
valu
e;
public:
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->fenotyp
e;
+ Type get()
const
{
+ return
valu
e;
}
};
}
}
};
}