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.

相关推荐
Bella的成长园地9 小时前
面试中关于 c++ async 的高频面试问题有哪些?
c++·面试
彷徨而立10 小时前
【C/C++】什么是 运行时库?运行时库 /MT 和 /MD 的区别?
c语言·c++
qq_4171292510 小时前
C++中的桥接模式变体
开发语言·c++·算法
No0d1es12 小时前
电子学会青少年软件编程(C语言)等级考试试卷(三级)2025年12月
c语言·c++·青少年编程·电子学会·三级
bjxiaxueliang13 小时前
一文掌握C/C++命名规范:风格、规则与实践详解
c语言·开发语言·c++
xu_yule14 小时前
网络和Linux网络-13(高级IO+多路转接)五种IO模型+select编程
linux·网络·c++·select·i/o
2301_7657031414 小时前
C++与自动驾驶系统
开发语言·c++·算法
轩情吖14 小时前
Qt的窗口(三)
c++·qt
热爱编程的小刘14 小时前
Lesson04---类与对象(下篇)
开发语言·c++·算法
郝学胜-神的一滴15 小时前
Linux网络编程之listen函数:深入解析与应用实践
linux·服务器·开发语言·网络·c++·程序人生