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.

相关推荐
Tanecious.1 小时前
蓝桥杯备赛:Day3-P1918 保龄球
c++·蓝桥杯
良木生香1 小时前
【C++初阶】:C++类和对象(下):构造函数promax & 类型转换 & static & 友元 & 内部类 & 匿名对象 & 超级优化
c语言·开发语言·c++
三雷科技2 小时前
使用 `dlopen` 动态加载 `.so` 文件
开发语言·c++·算法
旖-旎3 小时前
分治(快速选择算法)(3)
c++·算法·leetcode·排序算法·快速选择
xiaoye-duck3 小时前
【C++:哈希表封装】哈希表封装 myunordered_map/myunordered_set 实战:底层原理 + 完整实现
数据结构·c++·散列表
A.A呐4 小时前
【C++第二十三章】C++11
开发语言·c++
亿秒签到4 小时前
L2-007 家庭房产
数据结构·c++·算法
2401_892070985 小时前
【Linux C++ 日志系统实战】日志消息对象 LogMessage 完整实现:流式拼装 + 标准化输出
linux·c++·日志系统·流式日志
paeamecium5 小时前
【PAT甲级真题】- Longest Symmetric String (25)
数据结构·c++·算法·pat考试
A.A呐6 小时前
【C++第二十二章】哈希与散列
c++·算法·哈希算法