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 blocks[displayMessage() function include cout contents.]

The repair Codes like the below program:
Output result:

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

相关推荐
HL_风神16 分钟前
设计原则之迪米特
c++·学习·设计模式
HL_风神18 分钟前
设计原则之合成复用
c++·学习·设计模式
汉克老师44 分钟前
GESP2025年12月认证C++八级真题与解析(单选题10-12)
c++·递归··gesp八级·gesp8级
bkspiderx2 小时前
C++中的map容器:键值对的有序管理与高效检索
开发语言·c++·stl·map
Hard but lovely2 小时前
Linux: 线程同步-- 基于条件变量 &&生产消费模型
linux·开发语言·c++
L_09072 小时前
【C++】高阶数据结构 -- 平衡二叉树(AVLTree)
数据结构·c++
今儿敲了吗2 小时前
C++概述
c++·笔记
C+-C资深大佬2 小时前
C++逻辑运算
开发语言·c++·算法
阿华hhh2 小时前
项目(购物商城)
linux·服务器·c语言·c++
Qhumaing2 小时前
C++学习:【PTA】数据结构 7-2 实验6-2(图-邻接表)
数据结构·c++·学习