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.

相关推荐
陌路208 分钟前
日志系统7--异步日志的实现
c++
程序员Jared20 分钟前
C++11—this_thread
c++·this_thread
mjhcsp25 分钟前
C++ Manacher 算法:原理、实现与应用全解析
java·c++·算法·manacher 算法
Z1Jxxx1 小时前
0和1的个数
数据结构·c++·算法
朔北之忘 Clancy1 小时前
2020 年 6 月青少年软编等考 C 语言二级真题解析
c语言·开发语言·c++·学习·青少年编程·题解·尺取法
消失的旧时光-19431 小时前
C++ 中的 auto 与 nullptr:不是语法糖,而是类型系统升级
开发语言·c++
fpcc1 小时前
跟我学C++中级篇—C++17中的元编程逻辑操作
c++·模板编程
HABuo1 小时前
【Linux进程(五)】进程地址空间深入剖析-->虚拟地址、物理地址、逻辑地址的区分
linux·运维·服务器·c语言·c++·后端·centos
AuroraWanderll2 小时前
类和对象(六)--友元、内部类与再次理解类和对象
c语言·数据结构·c++·算法·stl
Tim_102 小时前
【C++入门】05、复合类型-数组
开发语言·c++·算法