im having a slight brain fart here on how to call an overloaded operator from an inherited class. Basically what im trying to do is use my overloaded assignment operator from a base class to create the assignment operator in my inherited class.
This code probably has other issues but im only concerned with the assignment operator at this time.
Base class assignment operator:
StringBetter & operator=(const char *);
how im trying to implement it in the inherited class:
Header file decleration:
Sourceline &operator=(const char *);
Implementation:
1 2 3 4
|
Sourceline Sourceline :: &operator=(const char *);
{
return StringBetter:: &operator=(const char *);
}
|
Here are the error messages i am receiving:
7 J:\School\Programming\progs\Sourceline\sourceline.cpp expected unqualified-id before '&' token
7 J:\School\Programming\progs\Sourceline\sourceline.cpp expected init-declarator before '&' token
7 J:\School\Programming\progs\Sourceline\sourceline.cpp expected `,' or `;' before '&' token
8 J:\School\Programming\progs\Sourceline\sourceline.cpp expected unqualified-id before '{' token
8 J:\School\Programming\progs\Sourceline\sourceline.cpp expected `,' or `;' before '{' token
I could be mashing some things together that just dont work and not be realizing it but im pretty sure i can do this because its the same idea as cumulative multiplication i.e.( 2*adt as apposed to adt*2) and using the one overloaded multiplication operator for both situations.
i hope this makes sense....