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.

相关推荐
t***54410 小时前
如何配置Orwell Dev-C++使用Clang
开发语言·c++
CoderCodingNo10 小时前
【信奥业余科普】C++ 的奇妙之旅 | 13:为什么 0.1+0.2≠0.3?——解密“爆int”溢出与浮点数精度的底层原理
开发语言·c++
极客智造12 小时前
深入详解 C++ 智能指针:RAII 原理、分类特性、底层机制与工程实战
c++·智能指针
王璐WL13 小时前
【C++】类的默认成员函数(上)
c++
王老师青少年编程13 小时前
csp信奥赛C++高频考点专项训练之贪心算法 --【区间贪心】:区间覆盖(加强版)
c++·算法·贪心·csp·信奥赛·区间贪心·区间覆盖(加强版)
宏笋14 小时前
C++11完美转发的作用和用法
c++
格发许可优化管理系统14 小时前
MathCAD许可类型全面解析:选择最适合您的许可证
c++
旖-旎14 小时前
深搜(二叉树的所有路径)(6)
c++·算法·leetcode·深度优先·递归
GIS阵地15 小时前
QGIS的分类渲染核心类解析
c++·qgis·开源gis
凯瑟琳.奥古斯特15 小时前
C++变量与基本类型精解
开发语言·c++