C++ | Friends :')

/ 26 Sept 2013 /
Why have people friends, when you can have function friends?




#include <iostream>
#include <string>

using namespace std;

class Stank{
 public:
  Stank(){
   stink=0;
  }
 private:
  int stink;
  
 friend void stinkfr(Stank &sfo);
  
};

void stinkfr(Stank &sfo){
 sfo.stink = 99;
 cout << sfo.stink << endl;
}

int main() {
 Stank bob;
 stinkfr(bob);
}
 
Copyright © 2010 M(ath)+me, All rights reserved