0

Is Implementation correct for class adapter pattern

Please find below code: https://code.sololearn.com/cWuZPn36M1Cw/#cpp Not finding any example for class adapter pattern [struct EmployeeAdapter2]. Is implementation correct? Also feel free to share your view for object adapter pattern [struct EmployeeAdapter] also.

16th Apr 2022, 6:28 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
3 Answers
+ 1
struct EmployeeAdapter2 : iEmployee, Human { EmployeeAdapter2() = default; EmployeeAdapter2(string name, string lastName) : Human(name, lastName) {} void display() { Human::display(); } void getfirstName() { Human::display(); // You probably meant getfirstName here } void getLastName() { Human::display(); // You probably meant getLastName here } };
1st Oct 2023, 9:41 AM
D1M3
D1M3 - avatar
0
Can you Tell me what you want to Code?
1st Oct 2023, 9:27 AM
D1M3
D1M3 - avatar
0
I want to achieve the same goal i achieved using current code. Actually, current code EmployeeAdapter Has composition. This is called object adapter scenario. What if i dont want to use object adapter and use class adapter using inheritance.
1st Oct 2023, 9:35 AM
Ketan Lalcheta
Ketan Lalcheta - avatar