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.

相关推荐
feng_you_ying_li6 小时前
C++复习二,继承与多态
c++
小小de风呀6 小时前
de风——【从零开始学C++】(十一):list的基本使用和模拟实现
开发语言·c++·list
陌路206 小时前
C++高级进阶--夯实进阶基础(1)
开发语言·c++
郝学胜-神的一滴8 小时前
中级OpenGL教程 008:精准控制高光光斑大小与强度
c++·unity·godot·three.js·图形学·opengl·unreal
牢姐与蒯8 小时前
c++数据结构之c++11(一)
数据结构·c++
折戟不必沉沙8 小时前
构造和析构函数能否是虚函数?能否调用虚函数?
c++
-To be number.wan9 小时前
算法日记 | STL- sort排序
c++·算法
不想写代码的星星9 小时前
编译期策略模式:当模板成为策略容器
c++
啦啦啦啦啦zzzz9 小时前
数据结构:平衡二叉树
数据结构·c++·二叉树
玖釉-9 小时前
Vulkan 中 Shader 的 vert、frag、mesh、comp 全面解析:作用、关系、特点与工程实践
开发语言·c++·windows·算法·图形渲染