Witam. Mam mały problem a mianowicie mam taki kod:
class Obiekt
{...
public:
bool LadujObiekt(string path);
}
problem polega w przeciążeniu operatora= tak aby po = przyjmował stringa, spróbowałem go zrobić tak:
Obiekt& operator= (string path)
{
this->LadujObiekt(path);
return *this;
};
Kompilować się kompiluje ale podczas wrzucenia mu stringa wywala error: conversion from 'std::string' to non-scalar type 'Obiekt' requested|
Jest możliwe w ogóle takie przeciążenie operatora?