Connecting iMac and MacBook Pro
So I have a MacBook Pro (15-inch, 2018) and iMac (21.5-inch, 2017), and I'm wondering if it's possible to connect the two so that I can use the iMac as a second display for the MacBook Pro. I was looking at the support article on the topic and just came away thoroughly confused about if they're compatible. If so, which adapters/cables would I need.
Thanks!
MacBook Pro 13", OS X 10.10