View Single Post
Old 03-09-2009, 18:52   #1
Ikon O'Cluster
Registered User
 
Iscritto dal: May 2009
Messaggi: 300
[C++] Urgente: Magheggi con funzioni friend

Volevo sapere se si puņ e se no come si puņ fare qualcosa del genere:

Codice:
class A;

class B {
   void funB(A a) {a.funA();} // VORREI CHE SIA CORRETTO (ORA E' SEGNALATO COME ERRORE PERCHE' funA NON E' DEFINITA)
   void funC(A a) {a.funA();} // DEVE ESSERE RILEVATO COME ERRORE
}

class A {
   friend void B::funB(A a);

   protected:
      void funA() {/*...*/};
}
So che si puņ dichiarare friend la classe B, ma io voglio che solo funB possa chiamare funA, mentre funC non deve poterlo fare.

Ultima modifica di Ikon O'Cluster : 03-09-2009 alle 19:21.
Ikon O'Cluster č offline   Rispondi citando il messaggio o parte di esso