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.

相关推荐
沐怡旸43 分钟前
【穿越Effective C++】23.宁以non-member、non-friend替换member函数
c++·面试
青小俊1 小时前
【代码随想录c++刷题】-二分查找 移除元素 有序数组的平方 - 第一章 数组 part 01
c++·算法·leetcode
赖small强2 小时前
【Linux C/C++开发】第16章:多线程编程基础
linux·c语言·c++·多线程编程·进程和线程的本质区别
AA陈超2 小时前
以 Lyra 的架构为基础,创建一个名为 “Aura“ 的英雄并实现发射火球技能
c++·笔记·学习·ue5·lyra
xlq223223 小时前
16.17.list(上)
c++·list
cpp_25014 小时前
P1765 手机
数据结构·c++·算法·题解·洛谷
未到结局,焉知生死4 小时前
PAT每日三题11-20
c++·算法
就是ping不通的蛋黄派4 小时前
数据结构与算法—线性表(C++描述)
数据结构·c++
杜子不疼.6 小时前
【C++】深入解析AVL树:平衡搜索树的核心概念与实现
android·c++·算法
永远不打烊6 小时前
c++11 之 统一初始化(Uniform Initalization)
c++·程序员