#include <iostream> using namespace std; class Pierwsza{public: void lol() { cout << "asdsaf"; }}; class Druga{public: void nic(const Pierwsza &p) { /* czy da sie wywolac metode lol bez usuwania const z metody nic? */ p.lol(); // blad }}; int main(){ system("pause"); return 0;}
Standard input is empty
prog.cpp: In member function ‘void Druga::nic(const Pierwsza&)’: prog.cpp:23:9: error: passing ‘const Pierwsza’ as ‘this’ argument of ‘void Pierwsza::lol()’ discards qualifiers [-fpermissive] p.lol(); // blad ^
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!