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.

相关推荐
王老师青少年编程38 分钟前
csp信奥赛C++高频考点专项训练之字符串 --【字符串排序】:合并序列
c++·字符串·csp·高频考点·信奥赛·字符串排序·合并序列
handler011 小时前
UDP协议与网络通信知识点
c语言·网络·c++·笔记·网络协议·udp
神仙别闹2 小时前
基于QT(C++)实现学生成绩管理系统
数据库·c++·qt
君义_noip3 小时前
CSP-S 2025 入门级 第一轮(初赛) 完善程序(1)
c++·算法·信息学奥赛·初赛·csp 第一轮
蜡笔小马4 小时前
07.C++设计模式-组合模式
c++·设计模式·组合模式
liulilittle4 小时前
TCP UCP v1.0:BBR 的非破坏性约束层
网络·c++·网络协议·tcp/ip·算法·c·通信
每天回答3个问题5 小时前
leetcodeHot100 | 104.二叉树的最大深度
c++·面试·
坚果派·白晓明5 小时前
【鸿蒙PC三方库移植适配框架解读系列】第五篇:完整流程图与角色职责
c语言·c++·华为·harmonyos·鸿蒙
xiao_li_ya5 小时前
C++学习日记1(`*`的理解、const关键词)
开发语言·c++
郝学胜-神的一滴7 小时前
Qt 入门 01-02: 开发环境搭建指南
开发语言·c++·qt·客户端