Re: What makes a class view as an embed object
From: Robert W Hand (rwhand_at_NOSPAMoperamail.com)
Date: 10/14/04
- Next message: Chris \( Val \): "Re: $$ private tutoring - osmium"
- Previous message: Chris \( Val \): "Re: A problem about "vector" for c++ beginner"
- Next in thread: Denis _at_ Work: "Re: What makes a class view as an embed object"
- Reply: Denis _at_ Work: "Re: What makes a class view as an embed object"
- Maybe reply: Alwyn: "Re: What makes a class view as an embed object"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 14 Oct 2004 05:10:12 -0400
On Thu, 21 Oct 2004 13:40:31 -0400, "Denis @ Work" <denisco@ica.net>
wrote:
>I have develop a string type class, I would like to know what would make my
>class object view in the debugger as a char *;
Sorry, that would depend on your debugger. You would get better
answers by asking in a group devoted to your compiler.
>Plus when I use that class object in a parameter such as printf( to be
>seeing as a char string.
It is useful to give a code example. I assume that you are doing
something like:
printf("%s\n", myClassObject);
Unless there is a conversion specified in your class definition, I
cannot see how that would work. In many string classes, such as
std::string, there are converters to pointer to const char.
printf("%s\n", myClassObject.c_str());
The second argument returns a pointer to const char that contains the
value of the string class object.
>I am comparing my class with the string and the mfc CString class but it is
>not obvious how it does the trick.
Again, code is useful. I assume that you are writing something like
this:
std::string stdString;
MyString mystring;
mystring == stdString;
Have you defined an operator ==() in your string class? Does it
compare to std::string and CString (in both directions)?
>Does it have to do with private public and protected member?
Only indirectly. You would need public comparison operators defined
for your class.
-- Best wishes, Bob
- Next message: Chris \( Val \): "Re: $$ private tutoring - osmium"
- Previous message: Chris \( Val \): "Re: A problem about "vector" for c++ beginner"
- Next in thread: Denis _at_ Work: "Re: What makes a class view as an embed object"
- Reply: Denis _at_ Work: "Re: What makes a class view as an embed object"
- Maybe reply: Alwyn: "Re: What makes a class view as an embed object"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|