Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
‘int R::print() const’ cannot be overloaded
#include<iostream> using namespace std; class R { public: R(int r1, int r2) : r1(r1), r2(r2) { } void print(); void print() const; // Tried to test overload "void print() const" member function must be Void type?? int print() const; //error private: int r1, r2; }; void R::print() { cout << r1 << "," << r2 << endl; } void R::print() const { cout<<"Const" << r1 << "," << r2 << endl; } int R::print1() const { cout<<"Int Const" << this->r1 << "," << this->r2 << endl; return 1; } int main() { R a(5,4); a.print(); //calling void print() const R b(20,52); b.print(); //calling void print() const R c(12,16); c.print(); //calling int print() const return 0; }
run
|
edit
|
history
|
help
0
Compatibilità
Split in C++ (Simple)
infix to postfix v 6.0 - (exponent support + multiple digits)
zeroout
mine
Policy based smart pointer
operator++
Newspaper
დიოფანტეს განტოლება
Functions-Part I