error: forming reference to void

The mistake is like the below picture:

The reason is Instantiation Object then call function, but displayMessage() function include cout function. After load this wrong, repair the Codes like the below picture:

The output result:

Good Luck!! I hope the answer could help you solve this problem.

相关推荐
T0uken1 小时前
现代 C++ 项目的 CMake 工程组织
c++
H CHY1 小时前
C++代码
c语言·开发语言·数据结构·c++·算法·青少年编程
xiaolang_8616_wjl1 小时前
c++题目_传桶(改编于atcoder(题目:Heavy Buckets))
数据结构·c++·算法
小小8程序员2 小时前
除了 gcc/g++,还有哪些常用的 C/C++ 编译器?
c语言·开发语言·c++
希望_睿智2 小时前
实战设计模式之中介者模式
c++·设计模式·架构
博语小屋3 小时前
转义字符.
c语言·c++
Lhan.zzZ4 小时前
Qt跨线程网络通信:QSocketNotifier警告及解决
开发语言·c++·qt
Aevget4 小时前
QtitanDocking 如何重塑制造业桌面应用?多视图协同与专业界面布局实践
c++·qt·界面控件·ui开发·qtitandocking
-森屿安年-4 小时前
STL中 Map 和 Set 的模拟实现
开发语言·c++
历程里程碑4 小时前
双指针巧解LeetCode接雨水难题
java·开发语言·数据结构·c++·python·flask·排序算法