c ++模板化函数调用

时间:2017-07-02 23:03:41

标签: c++ function oop

template <class ElementType>

Event<ElementType>::Event(){
    Queue<ElementType> q = *new Queue<ElementType>();

}


int main(){
    Queue<class ElementType> q = *new Queue<ElementType>();

    Event<ElementType> evt = *new Event<ElementType>();



    evt.simulation();

    return 0;
}


template <class ElementType>
void Event<ElementType>::simulation(){
    Queue<ElementType> bankLine = *new Queue<ElementType>();
    PriorityQueue<ElementType> eventpqueue = *new PriorityQueue<ElementType>
();

    bool avalteller = true;
    bankLine.
    while(!(bankLine.template bankline.isEmpty<ElementType>())){
        //file reader
        Queue<ElementType> newEvent = bankLine.peek();
    }





    while(!eventpqueue.template eventpqueue.isEmpty<ElementType>()){
        PriorityQueue<ElementType> newEvent = eventpqueue.peek();

        int cTime = newEvent.getTime();

        if(newEvent.template getType<ElementType>() == "A"){
            processArrival(newEvent, eventpqueue, bankLine);

        }
        else{
            processDeparture(newEvent, eventpqueue, bankLine);
        }
    }

}

我可以问一下如何调用Queue bankLine和PriorityQueue eventpqueue?

我搜索调用那些函数,我这样做了,但是我得到了XCODE的非限定id错误。

Queue和PriorityQueue是彼此不同的头文件,它们都有cpp文件。我希望致电bankLine.isEmpty()函数和eventpqueue.isEmpty()

0 个答案:

没有答案