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.

相关推荐
冉佳驹11 分钟前
C++ ——— 仿函数的使用、继承方式、赋值转换规则、菱形继承与虚继承
c++·继承·virtual·仿函数·菱形继承·模板特化·虚继承
咔咔咔的1 小时前
955. 删列造序 II
c++
xu_yule1 小时前
算法基础(数论)—欧拉函数
c++·算法·欧拉函数
xu_yule1 小时前
算法基础(数学)—数论
c++·算法·数论·最大公约数和最小公倍数·质数的判定·筛质数
Sheep Shaun1 小时前
二叉搜索树(下篇):删除、优化与应用
数据结构·c++·b树·算法
superman超哥1 小时前
仓颉借用检查器工作原理深度解析
c语言·开发语言·c++·python·仓颉
CoderCodingNo2 小时前
【GESP】C++五级真题(数论考点) luogu-B3871 [GESP202309 五级] 因数分解
开发语言·c++
ComputerInBook2 小时前
C++编程语言:标准库:第43章——C语言标准库(Bjarne Stroustrup)
c语言·c++·c语言标准库
wildlily84273 小时前
C++ Primer 第5版章节题 第九章
开发语言·c++
特立独行的猫a3 小时前
c++弱引用指针std::weak_ptr作用详解
开发语言·c++·智能指针·弱指针·weak_ptr