class new_hashtable {
public:
/* This is the datatype stored in the hashtable slots. */
struct KEY_VALUE {
KEY k;
VALUE v;
KEY_VALUE(const KEY &k_,const VALUE &v_) :k(k_), v(v_) {}
KEY_VALUE() {}
};
}
In above codes, is KEY_VALUE(const....) :k(k_), v(v_){} a copy constructor?? What does k(k_), v(v_) part do ?
The difference between
classandstructin C++ is that the default forstructis public. Other than that they’re exactly the same.So you have an inner class
KEY_VALUEwith all the members and methods public, with 2 constructors: the default, and one that receives 2 parameters. It is not a copy constructor.k(k_), v(v_)is the initialization list.