tags:

views:

25

answers:

2
template< class Type >

class cStack
{
    Type *m_array;
    int m_Top;
    int m_Size;

public:cStack();
       cStack(const Type&);
       cStack(const cStack<Type> &);
       bool Is_Full();
       bool Is_Empty();
       void InsertValue(const Type&);
       void RemeoveValue();
       ~cStack();
};

template< class Type >
class Smartpointer
{
    cStack<Type> *sPtr;
public: Smartpointer();
        Smartpointer(const Type&);
        Type* operator->();
        Type& operator*();
};

int main()
{ Smartpointer<int> sptr(1);
sptr->InsertValue(2);//its not calling insertvalue

}

}
+1  A: 

An int does not have a method called InsertValue. May-be you wanted to use a SmartPointer<cStack<int> >?

UncleBens
I was looking at wondering if it would even compile..
Brendan Long
A: 

Your operator->() returns a Type*, not a cStack. If you want to be calling InsertValue, a pointer to Type is not what you want.

Joel