I was studying what my book called "constant member functions" in C ++. that is, functions that can not change any attribute of the class or call other methods that are not constants. So I made this code in C ++.
#include <iostream>
#include <string>
using namespace std;
class Foo
{
string outra_coisa;
public:
void printa_algo(string algo) const;
};
int main()
{
Foo tolo;
string alguma_coisa = "coisa_alguma";
tolo.printa_algo(alguma_coisa);
return 0;
}
void Foo::printa_algo(string algo) const
{
cout << algo;
}
Is it possible to do the same in PHP ?