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.

相关推荐
cccccc语言我来了3 小时前
C++轻量级消息队列服务器
java·服务器·c++
闻缺陷则喜何志丹3 小时前
【背包 组合】P7552 [COCI 2020/2021 #6] Anagramistica|普及+
c++·算法·背包·洛谷·组合
xiaoye-duck3 小时前
【C++:C++11】C++11新特性深度解析:从类新功能、Lambda表达式到包装器实战
开发语言·c++·c++11
一个行走的民3 小时前
C++ Lambda 表达式语法详解
c++
小小码农Come on4 小时前
C++访问QML控件-----QML访问C++对象属性和方法
java·开发语言·c++
Yungoal4 小时前
项目层级结构
c++
程序员-King.5 小时前
【基础分析】—— 条件变量wait(lock, 谓词)
c++·c·多线程·条件变量
故事和你915 小时前
洛谷-算法1-7-搜索3
数据结构·c++·算法·leetcode·动态规划
网域小星球5 小时前
C++ 从 0 入门(四)|继承、多态、this 指针、深浅拷贝(C++ 面试终极收官)
开发语言·c++·面试·多态·继承·this指针·深浅拷贝
想唱rap5 小时前
C++智能指针
linux·jvm·数据结构·c++·mysql·ubuntu·bash