Advertisement

Need Some Guidence :)

Started by May 02, 2002 06:48 AM
14 comments, last by Klear 22 years, 7 months ago
One thing - you need to fix your function return types. Your functions are returning char - they need to return String.

Landsknecht
My sig used to be, "God was my co-pilot but we crashed in the mountains and I had to eat him..."
But folks whinned and I had to change it.
Siebharinn I don''t see any difference in putting
char tmpname[] in

Address:utname(char tmpname[])

as a parameter or putting

Address:utname(char *tmpname)

these both r same then y u emphisizing on using the later one. Actually char tmpname[] is same as char* const tmpname.



Advertisement
Should there be two separate classes? One fore creating the contact and another viewing it?
Here is the beginning of my CreateContact class. I still have do alot to it such as it saving the contacts info to a file. How would I implement this? Thanks


  class CreateContact{	public:      void SetName(const char* tmpname) {      	name = tmpname;      }      void SetEmail(const char* tmpemail) {      	email = tmpemail;      }      void SetPhone(const char* tmpphone) {      	phone = tmpphone;      }      void SetPhoneb(const char* tmpphoneb) {      	phoneb = tmpphoneb;      }      void SetAddress(const char* tmpaddress) {      	address = tmpaddress;      }      void SetComment(const char* tmpcomment) {      	comment = tmpcomment;      }   private:   	string name;      string email;      string phone;      string phoneb;      string address;      string comment;};  
added string copy like Promit said to:


  class CreateContact{	public:      void SetName(const char* tmpname) {      	strcpy(name ,tmpname);      }      void SetEmail(const char* tmpemail) {      	strcpy(email ,tmpemail);      }      void SetPhone(const char* tmpphone) {      	strcpy(phone ,tmpphone);      }      void SetPhoneb(const char* tmpphoneb) {      	strcpy(phoneb ,phoneb);      }      void SetAddress(const char* tmpaddress) {      	strcpy(address ,tmpaddress);      }      void SetComment(const char* tmpcomment) {      	strcpy(comment ,tmpcomment);      }   private:   	string name;      string email;      string phone;      string phoneb;      string address;      string comment;};  
How would I get the class to save contact information to a file to later be brought up to be viewed. This file needs to be set up so it can hold other contacts as well. Thanks

This topic is closed to new replies.

Advertisement