Can a professor teach mathematics and computer science?
I don't know how common this is now, but about 15 years ago I was a visiting assistant professor in mathematics at a small liberal arts college in the U.S., a position that became available because, in trying to fill a tenure-track computer science position, no suitable candidates were found by late March or early April, and so the search was ended and a new search was started for a visiting math position, with one of the math faculty members helping out by teaching a couple of beginning computer science courses and one or two of the computer science professors teaching an extra class. In fact, I had consecutive visiting positions at TWO different colleges/universities back then for this same reason (no suitable computer science candidates were found for a tenure track position), and in each case the reason the visiting position was for math and not for computer science was due to the overwhelming greater number of experienced (in teaching) candidates that a math search would generate this late in the hiring season.

The same department tried again the next year, with the same result (I believe the other place I had a visiting position at was successful the second time), and the same math faculty member pitched in again, this time I believe teaching only computer science. Over a period of several years this faculty member transitioned to computer science, and has since written two textbooks in computer science. For what it's worth, I do not think this faculty member originally had much of a background in computer science (maybe a couple of courses as an undergraduate), but I believe this person had started being interested in computer science at least a couple of years before I was there.