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.

相关推荐
某不知名網友19 分钟前
ROS2 核心通信:话题发布与订阅详解
开发语言·c++
C++ 老炮儿的技术栈21 分钟前
char (*csConnectName)[256]; 和 char csConnectName [256] 有什么区别
java·c语言·开发语言·c++·人工智能·算法·c
大鹏说大话39 分钟前
C++ STL 容器怎么选?vector、list、map、unordered_map 对比
开发语言·c++·list
JMchen42 分钟前
性能优化——让Native代码飞起来
android·c++·性能优化
chenbingjie_c1 小时前
手撕 C++ priority_queue:二叉堆 + 模板仿函数 + 模板特化(保姆级逐函数拆解)
开发语言·c++
小小龙学IT1 小时前
C++ Redis 客户端深度解析(hiredis 与 redis-plus-plus)——工业数采实时缓存 C++ 侧实战
c++·redis·缓存
垆边人似月.2 小时前
华为机试题 :最长递增子序列题目
数据结构·c++·算法·华为
开发者联盟league2 小时前
c++11 使用chrono库转换时间点和字符串,计算时间点间隔
java·c++·算法
蜕变的土豆3 小时前
工业监控RTSP取流-实践指南
c++·视频
进化中的刀盾兽3 小时前
从零实现 C++ Json-Rpc(八):补齐 detail.hpp——JSON 封装与请求 ID 生成
c++·rpc