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.

相关推荐
Tansmjs19 小时前
C++中的工厂模式变体
开发语言·c++·算法
naruto_lnq19 小时前
多平台UI框架C++开发
开发语言·c++·算法
爱装代码的小瓶子19 小时前
【C++与Linux基础】文件篇(8)磁盘文件系统:从块、分区到inode与ext2
linux·开发语言·c++
naruto_lnq19 小时前
分布式日志系统实现
开发语言·c++·算法
Zsy_05100319 小时前
【C++】stack、queue、容器适配器
开发语言·c++
星火开发设计19 小时前
命名空间 namespace:解决命名冲突的利器
c语言·开发语言·c++·学习·算法·知识
安全二次方security²20 小时前
CUDA C++编程指南(7.31&32&33&34)——C++语言扩展之性能分析计数器函数和断言、陷阱、断点函数
c++·人工智能·nvidia·cuda·断点·断言·性能分析计数器函数
爱学习的阿磊20 小时前
C++中的策略模式应用
开发语言·c++·算法
L_090720 小时前
【Linux】进程状态
linux·开发语言·c++
NaCl鱼呜啦啦20 小时前
0126-0201编程心得
c++