I would like to define a copy-constructor which just assigns the object to another one:
Header:
#ifndef TESTCLASS_HPP
#define TESTCLASS_HPP
#include <boost/math/distributions/geometric.hpp>
class Testclass {
public:
Testclass();
virtual ~Testclass();
private:
Testclass(const Testclass& orig);
int alpha;
boost::math::geometric_distribution <> geometricboost;
};
#endif /* TESTCLASS_HPP */
Implementation:
#include "Testclass.hpp"
Testclass::Testclass() : geometricboost(0) {
}
Testclass::Testclass(const Testclass& obj_ref) {
*this = obj_ref;
}
Testclass::~Testclass() {
}
The class itself doesn't contain any pointers, but eventually an object. IS this actually possible to do?
If not, what would be the easiest way just to just assign?
This gives the error:
Testclass.cpp: In copy constructor ‘Testclass::Testclass(const Testclass&)’: Testclass.cpp:13:46: error: no matching function for call to ‘boost::math::geometric_distribution::geometric_distribution()’ Testclass::Testclass(const Testclass& obj_ref) {