+ 2

Adapter design pattern with member variable

Hi I have almost came across example code of adapter pattern where only method is concerned... How can we work on member variables ? Refer below code and let me know whether am Missing anything or not ? I feel that code does not demonstrate proper adaptor... Can you please guide on this ? I want adapter to print XML for excel object. https://code.sololearn.com/cVq5MEQ8yUz4/?ref=app

4th Nov 2021, 4:55 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
3 odpowiedzi
+ 2
I don't know if I understood your question right. But it looks very simple for me. I just create a new constructor for Adapter class with parameter of type ExcelReport and created a new object of XMLReport with the data of the ExcelReport object. I did it like below: https://code.sololearn.com/ccfNGYt8q3ax/?ref=app
5th Nov 2021, 3:08 AM
Rishi
Rishi - avatar
+ 2
Ketan Lalcheta happy to help =)
6th Nov 2021, 2:30 AM
Rishi
Rishi - avatar
+ 1
Thanks 😊
5th Nov 2021, 4:47 PM
Ketan Lalcheta
Ketan Lalcheta - avatar