Finding area of rectangle and square using delegates

PHOTO EMBED

Sat Oct 16 2021 15:58:33 GMT+0000 (UTC)

Saved by @funcProgramming

int square(int x) { return x * x; }
int rectangle(int x, int y) { return x * y; }
AreaCalculatorDelegate rect = rectangle;
AreaCalculatorDelegate sqr = square;
int i = rect(1, 2);
int j = sqr(2);
content_copyCOPY