2011-12-09 78 views
0

我有這些C++類:生成類圖的工具?

class sales{ 
private: 
    float dollar[3]; 
public: 
    void getData(float f1,float f2, float f3){ 
     dollar[0]=f1;// sales of first month 
     dollar[1]=f2;// sales of second month 
     dollar[2]=f3;// sales of third month 
    } 
    void putData(){ 
     int count=0; 
     while(count!=3){ 
     cout<<dollar[count]<<"\t$"<<endl; 
     count++; 
     } 
    } 
}; 


class publication:public sales{ 
private: 
    string PubName; 
    int PubYear; 
public: 
    void SetName(string s){ 
     PubName=s; 
    } 
    string GetName(){ 
     return PubName; 
    } 
     void SetYear(int y){ 
     PubYear=y; 
    } 
    int GetYear(){ 
     return PubYear; 
    } 
}; 

class book:public publication{ 
private: 
    string Author; 
public: 
    void SetAuthor(string a){ 
     Author=a; 
    } 
    string GetAuthor(){ 
     return Author; 
    } 


}; 

class tape:public publication{ 
private: 
    string singer; 
public: 
    void SetSinger(string s){ 
     singer=s; 
    } 
    string GetSinger(){ 
     return singer; 
    } 


}; 

我想自動生成的類圖,有沒有在網上做的有用的工具?

回答

3

StarUML有一個逆向工程選項,它將根據您的源代碼生成UML圖(它是免費的,但不在線)。但是通常你應該在編寫任何代碼之前製作一個圖表。

2

使用doxygen它很容易使用,它爲您提供了開箱即用的圖形,並且非常適合記錄您的代碼 - 最重要的是:它是免費的。

+0

忘記了 - 好的呼籲doxygen - 它的便宜然後我的回答:-) –

0

我個人用戶的Enterprise Architect這可能是比你更需要的,但你可以嘗試的ArgoUML:

ArgoUML home page

如果使用Web Start的鏈接,這幾乎就像一個在線工具。