c++ - Can two classes access each other? -


if have 2 classes called , b,

note: following doesn't compile.

class { public:    static void funca() {}    void call_funcb() { b::funcb(); } // call class b's function };  class b { public:    static void funcb() {}    void call_funca() { a::funca(); } // call class a's function }; 

errors:

error c2653: 'b' : not class or namespace name error c3861: 'funcb': identifier not found 

can call static functions of each class?

you have this:

class { public:    static void funca() {}    void call_funcb() ; };  class b { public:    static void funcb() {}    void call_funca() { a::funca(); } // call class a's function };     void a::call_funcb() { b::funcb(); } // call class b's function 

this allows a::call_funcb() see b declaration.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -