44 virtual void printName() {
NRT_INFO(
"WidgetBase");}
50 class SmartWidget :
public WidgetBase
53 SmartWidget() {
NRT_INFO(
"Creating Smart Widget"); }
54 void printName() {
NRT_INFO(
"SmartWidget");}
57 std::shared_ptr<WidgetBase> createSmartWidget()
58 {
return std::shared_ptr<WidgetBase>(
new SmartWidget); }
65 const bool smartWidgetAdded = addSmartWidget();
68 class DumbWidget :
public WidgetBase
71 DumbWidget() {
NRT_INFO(
"Creating Dumb Widget"); }
72 void printName() {
NRT_INFO(
"DumbWidget");}
75 std::shared_ptr<WidgetBase> createDumbWidget()
76 {
return std::shared_ptr<WidgetBase>(
new DumbWidget); }
83 const bool dumbWidgetAdded = addDumbWidget();
88 smartWid->printName();