This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum class MessageType : char { | |
Add = 'A', | |
Modify = 'M', | |
Delete = 'D', | |
}; | |
void on_message(const MessageHeader& hdr, const void* payload) | |
{ | |
switch(hdr.type) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Multiple level of nesting | |
void func() | |
{ | |
if (...) { | |
if (...) { | |
... | |
} else { | |
if (...) { | |
... | |
} else if (...) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://www.youtube.com/watch?v=nLSm3Haxz0I | |
class MyWidget | |
{ | |
void tinker_with(int amount); | |
public: | |
class Tinkerable; | |
Tinkerable get_tinkerable(){ | |
return Tinkerable(*this); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://www.youtube.com/watch?v=nLSm3Haxz0I | |
class EventSource | |
{ | |
void add(Listener& listener); | |
void remove(Listener& listener); | |
public: | |
[[nodiscard]] | |
Subscription subscribe(Listener& listener) { | |
return Subscription(*this, listener); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://www.youtube.com/watch?v=zYPb7oBU5_E | |
#include "time_interface.h" | |
#include "output_interface.h" | |
class alarm_clock { | |
public: | |
alarm_clock(const time_interface&, output_interface&) | |
// ... | |
private: |