CString

T

tings

Writing my own CString class, how to implement a member method so that the
class' other members can return a CString like:

CString CString::WhateverMethod(...)
{
char ACharString[100];
...
return ACharString;
}

See that the example method return a char string that automatically converts
to a CString object.
 
P

Phlip

tings said:
Writing my own CString class

Tip: For a learner project, don't name your class the same as a very common
published class. Try just MyString or TingsString

Tip: Don't start classes with 'C'. Name classes after nouns, and reserve
everything beginning with C for Microsoft and its vassal states.
how to implement a member method so that the
class' other members can return a CString like:

CString CString::WhateverMethod(...)
{
char ACharString[100];
...
return ACharString;
}

See that the example method return a char string that automatically converts
to a CString object.

Give your string a constructor that takes a char const *. Look both those up
before proceding.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,167
Latest member
SusanaSwan
Top