| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Model and code examples of GoF Design Patterns for C++.
This project is available for the following objectives:
UML model example:
C++ header file example:
// ˅
// ˄
#ifndef STRUCTURAL_PATTERNS_COMPOSITE_FILE_H_
#define STRUCTURAL_PATTERNS_COMPOSITE_FILE_H_
// ˅
#include <string>
#include "structural_patterns/composite/FileSystemElement.h"
using namespace std;
// ˄
class File : public FileSystemElement
{
// ˅
// ˄
private:
const string name;
const int size;
public:
File(const string& name, const int size);
~File();
const string getName() const;
const int getSize() const;
// Print this element with the "upper_path".
void print(const string& upper_path) const;
// ˅
public:
protected:
private:
File(const File&) = delete;
File& operator=(const File&) = delete;
File(File&&) = delete;
File& operator=(File&&) = delete;
// ˄
};
// ˅
// ˄
#endif // STRUCTURAL_PATTERNS_COMPOSITE_FILE_H_
// ˅
// ˄C++ source file example:
// ˅
#include <iostream>
#include "structural_patterns/composite/File.h"
using namespace std;
// ˄
File::File(const string& name, const int size)
: name(name)
, size(size)
// ˅
// ˄
{
// ˅
// ˄
}
File::~File()
{
// ˅
// ˄
}
const string File::getName() const
{
// ˅
return name;
// ˄
}
const int File::getSize() const
{
// ˅
return size;
// ˄
}
void File::print(const string& upper_path) const
{
// ˅
cout << upper_path << "/" << toString() << endl;
// ˄
}
// ˅
// ˄UML Modeling Tool
Visual Studio

Code Generation from UML

Build and Run

This project is licensed under the Creative Commons Zero (CC0) license. The model and code are completely free to use.
C#, Crystal, Go, Java, JavaScript, Kotlin, Python, Ruby, Scala, Swift, TypeScript
| Back | FazBrowse Home | New Git URL |