+ 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
3 ответов
+ 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
+ 2
Ketan Lalcheta happy to help =)
+ 1
Thanks 😊