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.

相关推荐
艾莉丝努力练剑39 分钟前
【C++:C++11】C++11新特性深度解析:从可变参数模板到Lambda表达式
c++·stl·c++11·lambda·可变模版参数
同学小张3 小时前
【端侧AI 与 C++】1. llama.cpp源码编译与本地运行
开发语言·c++·aigc·llama·agi·ai-native
爱学习的小邓同学7 小时前
C++ --- 多态
开发语言·c++
招摇的一半月亮13 小时前
P2242 公路维修问题
数据结构·c++·算法
f***019314 小时前
CC++链接数据库(MySQL)超级详细指南
c语言·数据库·c++
合方圆~小文14 小时前
球型摄像机作为现代监控系统的核心设备
java·数据库·c++·人工智能
椰萝Yerosius15 小时前
[题解]2024CCPC郑州站——Z-order Curve
c++·算法
滨HI018 小时前
C++ opencv简化轮廓
开发语言·c++·opencv
学习路上_write18 小时前
FREERTOS_互斥量_创建和使用
c语言·开发语言·c++·stm32·单片机·嵌入式硬件
闻缺陷则喜何志丹20 小时前
【SOSDP模板 容斥原理 逆向思考】3757. 有效子序列的数量|分数未知
c++·算法·力扣·容斥原理·sosdp·逆向思考