|
-
January 21st, 2011, 10:20 AM
#1
Class design
Hi all, I have this class in my code:
class Mystring {
public:
char *s;
Mystring(const char *);
Mystring();
~Mystring(){}
Mystring operator=(const char* str)
{
strcpy (s, str);
return *this;
}
operator char *()//Conversion operator
{
return this->s;
}
//...
};
1) I would like to convert from Mystring* to Mystring** using a '=' operator. for this line to work:"
Mystring* p = new Mystring;
Mystring** pp = p;
2) And to convert from Mystring* to char* using a conversion operator (I already have one in my class).
I'm having difficulties with both issues, Thanks for any help!!
BanKuZ
Last edited by BanKuZ; January 21st, 2011 at 01:57 PM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|