我在类中定义了
B();
B(LPSTSTR lpName);
两个构造函数然后声明类的时候这样写
B b((LPCTSTR)strText);//strText为CString类型
却返回了
cannot convert parameter 1 from 'const char *' to 'const class B &'
这样的错误。求解

解决方案 »

  1.   

    LPSTSTR 和 LPCTSTR 不匹配啊
      

  2.   

    LPSTSTR 是个什么类型呀,写错了吧
      

  3.   

    B(LPCTSTR lpName); 
      

  4.   

    LPCTSTR   A 32-bit pointer to a constant character string that is portable for Unicode and DBCS.LPTSTR   A 32-bit pointer to a character string that is portable for Unicode and DBCS.
      

  5.   

    是不是因为继承的原因呢?
    B:A
    其中A也定义了一个这样的构造函数
    A(CString lpName);