So I trying to build this program that will take two char and a double. Once the user has input the information. I will transfer the information to an object by using the function below. But every time I try to compile i get this error incompatible types in assignment of const char* to char [20]. Can anyone give me a hand and clarify when im not understanding. Thanks in advance.
void Molecule::set(const char* sym, const char* type, double weighT);
And this how I call it.
molecule[i].set(symbol, description,weight);
And within the set() function I just have to transfer the values inpputed to my private member in my object which i did by using this-> function.
////So This part is supposed to transfer the value to my Class Molecule private members////
this->symbol_ = sym;
this->type_ = type;
this->weight_ = weighT;
///////Here is my Class Molecule////////
class Molecule{
private:
char symbol_[20];
char type_[20];
double weight_;
public:
void set(const char* sym, const char* type, double weighT);
void display() const;
};