Thanks pb, and yes, I am also new to C++. If I could just continue with this a little
further, I would really like to get it out of the way, if that's ok.
I did mean that wxString had already been declared:
The confusing part is the dot between my_wxTstring and Prepend(wxT(".")) .
Is this how I should interpret it:
Code: Select all
wxString my_wxString; // Here my_wxString is not a simple string,
// but an instance of the class wxString.
// Class wxString has a member function Prepend().
my_wxString.Prepend(wxT(".")) // Here I am calling the Prepend() member function
// of my new wxString class, and passing it another
// (temporary) instance of a wxString class created
// form wxT(".").
// Prepend() modifies my_wxString class, then destroys
// the temporary instance of wxString class it created
// from wxt(".")
From the help file:
Code: Select all
wxString::Prepend
wxString& Prepend(const wxString& str)
Prepends str to this string, returning a reference to this string.
What confused me was "returning a reference to this string". From regular C, I thought
the first wxString& was the address returned by the function wxString::Prepend(const wxString& str).
Why does it say that it returns a reference to a string, when it's actually modifying my_wxString,
an instance of the wxString class? I don't see how the two are equivalent.
Thank you for your patience