Say Im making a class bah and I've made this constructor
Is the above a good constructor ?Code:bah::bah (char* c) { char * pointer = c; }
Or would this be better :
This has not be compiled, just of the top of my head.Code:bah::bah(char* c) { char* pointer = new char[strlen(c)]; for (int counter=0; counter < strlen(c); counter++) pointer[counter] = c[counter]; }
Just wondering if there is any difference between them besides the obvious length of code ?