I've been trying to convince myself that that objects of the same type have access to each others private data members. I wrote some code that I thought would help me better understand what is going on, but now I am getting an error from XCODE7 (just 1), that says that I am using the undeclared identifier "combination."
If someone could help me understand where I have gone awry with my code, I would love to learn.
My code should simply print false, if running correctly.
#include <iostream>
using std::cout;
using std::endl;
class Shared {
public:
bool combination(Shared& a, Shared& b);
private:
int useless{ 0 };
int limitless{ 1 };
};
bool Shared::combination(Shared& a,Shared& b){
return (a.useless > b.limitless);
}
int main() {
Shared sharedObj1;
Shared sharedObj2;
cout << combination(sharedObj1, sharedObj2) << endl;
return 0;
}
Aucun commentaire:
Enregistrer un commentaire