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.

相关推荐
xu_yule15 小时前
算法基础(背包问题)-完全背包
c++·算法·动态规划·完全背包
gfdhy15 小时前
【c++】素数详解:概念、定义及高效实现(判断方法 + 筛法)
开发语言·c++·算法·数学建模·ai编程
lzh2004091915 小时前
Set 和 Map 深入详解及其区别
数据结构·c++
SmoothSailingT15 小时前
C/C++——结构体(Struct)
开发语言·c++·结构体·struct
Lucis__15 小时前
红黑树实现—规则&约束的平衡之道
数据结构·c++·算法·红黑树
名誉寒冰15 小时前
深入理解fd_set:从基础到实战应用(Linux/C++)
java·linux·c++
智者知已应修善业16 小时前
【字符串提取3个整数求和】2024-2-11
c语言·c++·经验分享·笔记·算法
博语小屋16 小时前
Linux 地址转换函数详解
linux·运维·服务器·c++
特立独行的猫a16 小时前
C++开发中的构建工具:现代CMake实战速成
开发语言·c++·cmake·入门教程
思成不止于此16 小时前
C++ STL中map与set的底层实现原理深度解析
开发语言·c++·set·map·红黑树·底层实现