Added visitor pattern test case
This commit is contained in:
@@ -17,6 +17,36 @@ diagrams:
|
||||
|
||||
```
|
||||
## Source code
|
||||
File t00018_impl.cc
|
||||
```cpp
|
||||
#include "t00018_impl.h"
|
||||
#include "t00018.h"
|
||||
|
||||
namespace clanguml {
|
||||
namespace t00018 {
|
||||
namespace impl {
|
||||
|
||||
widget::widget(int n)
|
||||
: n(n)
|
||||
{
|
||||
}
|
||||
|
||||
void widget::draw(const clanguml::t00018::widget &w) const
|
||||
{
|
||||
if (w.shown())
|
||||
std::cout << "drawing a const widget " << n << '\n';
|
||||
}
|
||||
|
||||
void widget::draw(const clanguml::t00018::widget &w)
|
||||
{
|
||||
if (w.shown())
|
||||
std::cout << "drawing a non-const widget " << n << '\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
File t00018_impl.h
|
||||
```cpp
|
||||
#pragma once
|
||||
@@ -101,36 +131,6 @@ widget &widget::operator=(widget &&) = default;
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
File t00018_impl.cc
|
||||
```cpp
|
||||
#include "t00018_impl.h"
|
||||
#include "t00018.h"
|
||||
|
||||
namespace clanguml {
|
||||
namespace t00018 {
|
||||
namespace impl {
|
||||
|
||||
widget::widget(int n)
|
||||
: n(n)
|
||||
{
|
||||
}
|
||||
|
||||
void widget::draw(const clanguml::t00018::widget &w) const
|
||||
{
|
||||
if (w.shown())
|
||||
std::cout << "drawing a const widget " << n << '\n';
|
||||
}
|
||||
|
||||
void widget::draw(const clanguml::t00018::widget &w)
|
||||
{
|
||||
if (w.shown())
|
||||
std::cout << "drawing a non-const widget " << n << '\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
## Generated UML diagrams
|
||||

|
||||
|
||||
Reference in New Issue
Block a user