c++ - how to access a variable in one .cc file from another in omnet++ -




i working on omnet++ project , looking solution following problem. have variable "numsent" in file a.cc , want access file b.cc. simplified code snippet below:

    a.cc     void a::handlefunc(cmessage *msg)     {     frame=encapsulate(msg);     numsent=frame.getvalue();     }         a.h     protected:     long numsent;     public:     void setupdate(csmacamac *obj);     long getupdate();      b.cc     #include a.h     void b::updatefunc()     {         *obj=new a();         obj->setupdate(obj);     ev<< "inside updategateway"<<obj->getupdate();     } 

however not retrieve value in a.cc instead gives default 0 value. tried declaring variable global using extern command. throws error. can suggest needs done.





wiki

Comments

Popular posts from this blog

elasticsearch - what is the equivalent data type for geo_point in hibernate search? -

Jenkins: find build number for git commit -

firebase - How to wait value in Ionic 2 -