CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 28

Thread: Class design

Threaded View

  1. #1
    Join Date
    Jan 2011
    Posts
    13

    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
  •  





Click Here to Expand Forum to Full Width

Featured