m_lt =  CLeitaiAction(); 没问题,
如果 m_lt =  new CLeitaiAction(); 
就会binary '=' : no operator defined which takes a right-hand operand of type 'class CLeitaiAction *' (or there is no acceptable conversion)这是什么原因?

解决方案 »

  1.   

    看你的代码m_lt是个CLeitaiAction类变量。
    你想NEW 那么要将 new 的对象存入一个CLeitaiAction指针对象。CLeitaiAction *plt = new CLeitaiAction;你上面的编译器只是说你没有定义operator=()运算符。不能进行 = 付值操作!
      

  2.   

    已经在另一个类的头文件中申明过,
    CLeitaiAction m_lt; 在这个类的cpp文件中m_lt =  new CLeitaiAction(); 就出现问题。
      

  3.   

    new出来应该是一个地址,这个概念我太模糊了,谢谢指点。
      

  4.   

    m_lt应该是个指针
    CLeitaiAction* m_lt;
      

  5.   

    new返回值是一个指向新建类型的指针
    CLeitaiAction *m_lt = new CLeitaiAction;正解m_lt =  CLeitaiAction(); 
    CLeitaiAction()返回的一般是个引用,所以也正确