c++ -fpermissive error while implement callback in c++ -


    class caller{ private:     callbackinterface &m_cb; public:     caller(callbackinterface& cb):m_cb(cb){}; 

doesn't give -fpermissive error whereas following gives. why so?

class caller{ private:     callbackinterface &m_cb; public:     caller(callbackinterface& cb){         m_cb=cb;     }; 

a reference variable should initialized when declaring. member variable constructed in constructor, should in initialization list .

if trying initialize member reference variable inside constructor, assignment variable should have been defined.

so code has issues in 2 fold

  1. reference variable not initialized when defined
  2. reference variable assigned once has been defined inside constructor.

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -