My idea for seamless interop to C++

Markus contact at markus-lanner.com
Wed Nov 18 15:50:48 UTC 2020


On Wednesday, 18 November 2020 at 15:10:53 UTC, jmh530 wrote:
> On Wednesday, 18 November 2020 at 14:04:36 UTC, Markus wrote:
> How does this line work
> fun->doFunStuff();
> if MarkdownToHtmlImpl only inherits from MarkdownToHtml and not 
> FunUseCase?
>
> Wouldn't you want to make a FunUseCase that has 
> MarkdownToHtmlImpl (or MarkdownToHtml) as a member?

You are completly right. I failed in the example. I fixed it.

It should of course look like this

```cpp
int main(int, char *[]) {
   std::shared_ptr<MarkdownToHtml> converter =
       std::make_shared<MarkdownToHtmlImpl>();
   std::shared_ptr<FunUseCase> fun = FunUseCase.create(converter);
   fun->doFunStuff();
   return 0;
}
```



More information about the Digitalmars-d mailing list