Create three Objects of the class and by using copy constructorto copy object 1 values to object 2 & 3 and print all the object’s data

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter2: Basic Elements Of C++
Section: Chapter Questions
Problem 2MC
icon
Related questions
Question

Write a C++ Program in which a class name Book that has attributes pages, price and title. It has the following member functions:

 

  • Input ( ) function is used to initialize the data members i.e. pages, price and
  • Display ( ) function is used to display all the values of data members.

 

Create three Objects of the class and by using copy constructorto copy object 1 values to object 2 & 3 and print all the object’s data as shown in the Output below.

 

I C\Users\hp\Documents\example 4.exe
enter Book Title
visual Programming
enter pages
B00
enter price
500
Details of Object 1..
Book Title
Pages
Price
= Visual Programming
= 300
= 500
Details of Object 2..
Book Title
Pages
Price
= Visual Programming
= 300
= 500
Details of Object 3..
Book Title
Pages
Price
= Visual Programming
= 300
= 500
Transcribed Image Text:I C\Users\hp\Documents\example 4.exe enter Book Title visual Programming enter pages B00 enter price 500 Details of Object 1.. Book Title Pages Price = Visual Programming = 300 = 500 Details of Object 2.. Book Title Pages Price = Visual Programming = 300 = 500 Details of Object 3.. Book Title Pages Price = Visual Programming = 300 = 500
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Data members
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning