Translating from Objective C to C++

Translating from Objective C to C++
0.0 0


Sorry if this is a stupid question :smiley: but I am trying to translate following this tutorial

In the below code is a function whose class extends NSObject,

  • (id)initWithEid:(uint32_t)eid {
    if ((self = [super init])) {
    *eid = eid;
    return self;
    When I translate it as:
    bool initWithEid
    if //Problem is here; CCObject does not have a init function



So do not call it.


Well, that worked! Btw could you please tell me what is the purpose of ‘init’ function? It is present in all the cocos objects. Actually, I haven’t been able to understand the flow of control of Cocos2d-x. So, will be grateful for your help


See wiki and especially this page: [[Easy_to_Learn*-*API_Style]].