我有一个叫做fileInfo.cpp的类,它包含了私有变量,一个公共构造函数,一个用变量做一些操作的公共方法,以及一些公共的getVariableX(){return variableX;}方法。这里是.h文件:为类和主类创建UML类图? C++
class fileInfo{
private:
string fileName;
string fileType;
int sampleRate;
int bitRes;
int channels;
public:
fileInfo(string s);
int pullValues();
std::vector<std::string> readSamples();
int getSampleRate();
int getBitRes();
int getChannels();
};
我有三个不同的主要类/程序,每个访问此fileInfo类。例如说我有一些程序叫做runthis.cpp
#include...
void concatFiles(string,string);
main(...){
concatFiles("this.txt","this2.txt");
}
void concatFiles(string file1,string file2){
fileInfo f = fileInfo(file1); //Here I access the fileInfo class
int isSuccessful = f.pullValues();
//todo
}
我该如何在UML图中显示这种关系?我会使用类图,用例图吗?