Focussing mainly on the US Navy for the sake of brevity: battleships, cruisers and destroyers all had multiple functions, and within each of these three types of ships there existed a variety of designs optimized for different functions. To start with the most relevant example: the USN (as did the Royal Navy) had a number of specialized anti-aircraft cruisers (CLAA) such as the Atlanta class, which carried no 6-inch guns (as did light cruisers) and no 8-inch guns (as did heavy cruisers); instead, the Atlantas carried 16 x 5-inch guns, 16 x 27mm guns and 6 x 20mm guns, which is more AAA firepower than a conventional US light cruiser of the time carried. So it has to be kept in mind that the word “cruiser” covers at least three different types of ships (light, heavy, and anti-aircraft), and arguably five or more types of ships if you add ultra-light Italian-type “destroyer leader” cruisers at the low end and the various types of battlecruisers and super-heavy cruisers at the high end.
The roles you describe for the three ship types were indeed one part of their respective function, but not their only (or even their defining) function. Destroyers were “maids of all work”: they were used for anti-aircraft defense, but they were also used for ASW (anti-submarine warfare), as shore-bombardment vessels (example: the USS Corry, DD-463, was sunk on D-Day in a duel with a German shore battery), as convoy escorts and so forth. At the opposite end: battleships were originally designed and intended for surface slugging matches against other battleships, but by WWII that role was being overtaken by events; in WWII, they spent more time fulfiling other jobs. Fast battleships, for example, got used a lot in the USN as escort vessels for fast carrier task forces, while slower battleships were used as shore-bombardment vessels to support amphibious landings.