2015-10-15 12 views
5

Ben sınıfın sınıfını yazıyorum. Ama projemi oluşturmak için mac osx kullanırken bazı sorunla karşılaşıyorum. h dosyası bunu beğendi ZAMAN:C++ <class T> şablonunu kullanırken hata: .. bir sınıf değil

template<class Queue_entry> 
class MyQueue { 
    public: 
    MyQueue(); 
    bool empty() const; 
    // add entry in the tail of the queue 
    Error_code append(Queue_entry &x); 
    // throw the entry of the front 
    Error_code serve(); 
    // get the front entry of the queue 
    Error_code retrieve(Queue_entry &x) const; 
protected: 
    Queue_entry entry[MAXQUEUE]; 
    int count; 
    int front, rear; 
}; 

O cpp file.Error hatası görünür: Ben

şablonu değiştirmek zaman wrong.But nasıl olur bilmiyorum

MyQueue.cpp:17:1: 'MyQueue' is not a class, namespace, or enumeration 

Başarılı bir şekilde çalıştırılabilir. Benim sınıf arkadaşı sorarken

cevap

6

Ben

template <class Queue_entry> 
MyQueue<Queue_entry>::MyQueue() {} 

Yani bu sorun çözüldü olmalıdır bilin. Formatı hatırlamalıyım.

+1

'class'mate haha ​​ Çözüm için teşekkürler, bu sorunun yanıtlandığı gibi işaretleyebilirsiniz :) –

İlgili konular