2015-10-19 67 views
0

我有nodes.h其中CNode定義爲這樣如何寫型堆的一類函數

struct CNode 
    { 
     int data; 
     CNode* link; 
    }; 

然後,我有稱爲queue.h與此類定義一個有趣的功能的單獨標頭:

Class queue 
{ 
public: 
.... //other functions 
CNode* front(); 
... //private members 
}; 

我的工作是編寫queue.h的實現(queue.cpp)。 因此,我的問題是:我將如何在實現文件中爲此編寫原型?

我已經嘗試過這兩個沒有成功:

queue::CNode* front() 
{} 

queue::queue CNode*::front() 
{} 

任何指導,將不勝感激。

+1

語法與往常一樣:返回值,名稱,參數。所以'CNode * queue :: front()' –

回答

0

的語法是:

CNode* queue::front() 

假設CNode被外queue定義。

沒有queue::你會宣佈一個完全不同的整體功能。

+0

當然,非常感謝! – megankfairy

相關問題