-4

参照変数/オブジェクトで->演算子を使用する状況はありますか?

typedef ABC::Derived<Tmplt> THandle;
THandle m_oNew;    
m_oNew->m_u16GetState();    // This is the function call. Here "->" is used.

これは、クラス「派生」と関数定義です。

template<class T>
class Derived;

class AnotherClass
{
    friend class Derived;

    inline AnimState m_u16GetState () const
    {
        return m_u16State;
    }
};
4

1 に答える 1

4

X->Y が使用されている場合、X は a) ポインター変数であるか、b) '->' 演算子は X の型に対してオーバーロードされている必要があります。

于 2012-11-02T01:39:00.907 に答える