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.

相关推荐
明洞日记29 分钟前
【CUDA手册004】一个典型算子的 CUDA 化完整流程
c++·图像处理·算法·ai·图形渲染·gpu·cuda
燃犀知不可乎骤得40 分钟前
MFC学习记录
c++·学习·mfc
星火开发设计1 小时前
C++ 运算符全解析:算术、关系、逻辑与位运算
java·开发语言·c++·学习·位运算·知识·操作符
Emilin Amy1 小时前
【C++】【STL算法】那些STL算法替代的循环
开发语言·c++·算法·ros1/2
天赐学c语言1 小时前
1.16 - 二叉树的中序遍历 && 动态多态的实现原理
数据结构·c++·算法·leecode
fpcc1 小时前
跟我学C++中级篇—std::is_swappable手动实现
c++
卜锦元1 小时前
EchoChat搭建自己的音视频会议系统01-准备工作
c++·golang·uni-app·node.js·音视频
ceclar1232 小时前
C++使用numeric
开发语言·c++
王老师青少年编程2 小时前
2024年12月GESP真题及题解(C++七级): 燃烧
c++·题解·真题·gesp·csp·七级·燃烧
汉克老师2 小时前
GESP2025年9月认证C++三级真题与解析(单选题9-15)
c++·算法·数组·string·字符数组·gesp三级·gesp3级