0
class ClassB{
public:
  ClassB(ClassA *_a) : a(_a), f1(NULL), f2(NULL)
      {if(!myListObj) myListObj= new myList;};

static myList *myListObj;

protected:

  ClassA *a;
  float *f1;
  float **f2;
};

The constructor looks weird. I have never seen such constructor signature. It looks like, it is taking only one parameter, an object "a" which is ClassA type pointer, but then there is f1 and f2 set as null. How f1 and f2 is added and how can a float type pointer be set as NULL?

Can anyone please help me understand the following part of the code-

ClassB(ClassA *_a) : a(_a), f1(NULL), f2(NULL)
          {if(!myListObj) myListObj= new myList;};
Natasha
  • 6,651
  • 3
  • 36
  • 58

0 Answers0