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.

相关推荐
llz_1125 分钟前
蓝桥杯备赛-搜索(DFS/BFS)
c++·算法·蓝桥杯·深度优先·宽度优先
郁闷的网纹蟒37 分钟前
虚幻5---第15部分---宝藏(掉落物)
开发语言·c++·ue5·游戏引擎·虚幻
俩娃妈教编程1 小时前
洛谷选题:P1888 三角函数
c++·算法
yuuki2332331 小时前
【C++】模拟实现 红黑树(RBTree)
java·开发语言·c++
一匹电信狗1 小时前
【Linux我做主】从 fopen 到 open:Linux 文件 I/O 的本质与内核视角
linux·运维·服务器·c++·ubuntu·小程序·开源
HAPPY酷1 小时前
C++ 音视频项目与 UE5 渲染与电影制作的关系
c++·ue5·音视频
初夏睡觉1 小时前
P2670 [NOIP 2015 普及组] 扫雷游戏 题解
c++
闻缺陷则喜何志丹1 小时前
【期望 DFS】P9428 [蓝桥杯 2023 国 B] 逃跑
c++·算法·蓝桥杯·深度优先·洛谷
落羽的落羽2 小时前
【C++】深入浅出“图”——最短路径算法
java·服务器·开发语言·c++·人工智能·算法·机器学习