error: expected primary-expression before ‘.‘ token << Book.displayMessage()

The wrong is like the below picture:

The reason is Book isn't Instantiation Object, it must Instantiation that it could call function, and you need know the Code must out of cout Codes blocksdisplayMessage() function include cout contents.

The repair Codes like the below program:
Output result:

Good Luck!! I hope the answer could solve your problem.

相关推荐
chenbingjie_c4 小时前
C++ 进阶核心知识点总结:模板、内存分区、new/delete、内存池
开发语言·c++
Frank_refuel6 小时前
【C++】Json库介绍和使用
c++
重生之小比特6 小时前
【C++进阶】map和set
java·开发语言·c++
知识分享小能手7 小时前
C++ 学习教程,从入门到精通,C++对象和类 — 详细知识点总结(10)
开发语言·c++·学习
顺顺 尼7 小时前
linux 进程信号(上)
linux·c++·算法
海上小飞龙9 小时前
改一个数,右边全得重算,这题怎么扛住两万次查询
java·c++·python
Persistent的粽子!9 小时前
双指针算法:最大盛水容器
c++·算法·leetcode
小小龙学IT9 小时前
三菱 PLC MC 协议(SLMP / QnA 兼容 3E 帧)深度解析:从帧结构到 C++/Go 双语言采集实战
c语言·c++·golang
程序猿编码9 小时前
C++/CUDA 手写 LLM 推理引擎:拆解 vLLM 核心 PagedAttention 与连续批处理
开发语言·c++·深度学习·神经网络·推理·vllm
hold?fish:palm9 小时前
44 二叉搜索树中第K小的元素
开发语言·c++·算法