c++ - insertvalue function in stack class is not calling when pointing by smartpointer class? please expain -
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 } }
an int
not have method called insertvalue. may-be wanted use smartpointer<cstack<int> >
?
Comments
Post a Comment