Pisze klasę String, nie mogę używać klasy string ze standardowej bibilioteki.
Chciałbym tak przeładować operator przypisania, by moc dopisywać znaki w ten sposób
#include "String.h"
int main()
{
String sx;
sx = "abc";
return 0;
}
String.cpp
String* String::operator=(String const&s)
{
this->napis = s.napis;
return this;
}
String.h
#pragma once
class String
{
public:
char* napis;
String* operator=(String const&);
String();
~String();
};
Przy takiej próbie, wyskakuje taki błąd:
Error C2679 binary '=': no operator found which takes a right-hand operand of type 'const char [4]' (or there is no acceptable conversion)