yinusxxxx

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
//
// Created by yinus on 2016/4/2.
//
#ifndef DS_AA_STACK_H
#define DS_AA_STACK_H

#include "List.h"
template <typename Object>
class Stack {
public:
    Stack():list() { }

    ~Stack(){}

    bool empty() const{
        return list.empty();
    }

    void clear(){
        list.clear();
    }

    int size() const{
        return list.size();
    }

    Object top() const{
        return list.back();
    }

    void push(const Object& x){
        list.push_back(x);
    }

    void pop(){
        list.pop_back();
    }

private:
    List<Object> list;
};


#endif //DS_AA_STACK_H

  

posted on 2016-04-02 19:16  yinusxxxx  阅读(178)  评论(0编辑  收藏  举报