Yeeeaaa. I found the solution to my own problem. You have to call the base call like this. I forgot the () the first time. Thanks for the help..
Mystats::operator =(const Mystats &rhs)
{
// Base class operator=
stats::operator = ( rhs );
// This class Operator=
w=rhs.w;
}
I have a subroutine that does this. Of course, I got this somewhere else, but I don't remember where.
const char * GetFileName(const char *pszPathName )
{
static CString STmp = pszPathName;
STmp.MakeReverse();
STmp = STmp.SpanExcluding("\\");
STmp.MakeReverse();
return STmp;
}
Thank you chpicker for your response, but your code does not use the operator= function, but a predefined copy constructor which is a bit copy of the original object. If you change your line of code
Mystats Newstat=mystat;
To
Mystats Newstat;
Newstat=mystat;
You will notice that the...
Thanks Ian for your quick responce. I have done that before, but I can seem to get the call correct with a operator function. Any ideas.. Thanks again..
I have two classes, one is the base class of the other. I would like call “operator = “ from the base class in addition to the new “operator =”. I know I am missing something simple, but I don’t know what.
class CAge
{
public:
CAge();
~CAge();
Cage & operator = (CAge &catmp)
{...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.