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.

相关推荐
paeamecium2 小时前
【PAT甲级真题】- Cars on Campus (30)
数据结构·c++·算法·pat考试·pat
UrSpecial3 小时前
从零实现C++轻量线程池
c++·线程池
chh5633 小时前
C++--模版初阶
c语言·开发语言·c++·学习·算法
会编程的土豆4 小时前
01背包与完全背包详解
开发语言·数据结构·c++·算法
hetao17338375 小时前
2026-04-12~14 hetao1733837 的刷题记录
c++·算法
智者知已应修善业6 小时前
【51单片机4位数循环小数位移数值位移】2023-6-9
c++·经验分享·笔记·算法·51单片机
王璐WL6 小时前
【C++】string,vector和list对比
c++·list
不爱吃炸鸡柳6 小时前
算法复杂度从入门到精通:时间与空间复杂度全解析
开发语言·c++·算法
拳里剑气6 小时前
C++算法:二分查找
c++·算法·二分查找·学习方法
故事和你917 小时前
洛谷-算法1-7-搜索2
数据结构·c++·算法·leetcode·深度优先·动态规划·图论