The reason for my asking is that I read, in a biography of King Ludwig II, that in Bavaria one did not address a prince(ss) as "Your Royal Highness" until the said person turned age 18 -- even if born a dynastic member of the house of Wittelsbach.
However, in his particular case, some sycophant in the Bavarian royal court actually addressed him from the beginning as Royal Highness. Otherwise, had protocol been followed properly, Ludwig would not have had this style until reaching his legal majority -- although he had become crown prince at the age of two-and-a-half.
Of course, a king is automatically a Majesty -- even if only a minor at the time of his accession to the throne. What this means is that Ludwig II would have been HRH for less than a year after turning 18, before being elevated to HM -- since he succeeded his father (King Maximilian II) only 6-1/2 months after his birthday.
As it was, protocol was broken in his case -- whatever might be said about his brother, Prince Otto. So he had been accustomed to hearing "Your Royal Highness" all his life, prior to his accession -- just like Charles III of Great Britain today (thanks to the Letters Patent of 1948, issued by his grandfather, King George VI).
I'm being tongue-in-cheek when saying "all his life" for King Ludwig II of Bavaria: he was not yet 19 years old when forced onto the throne -- thanks to the untimely death of his father. Reports at the time had it that he was totally startled upon hearing a courtier address him for the first time as "Your Majesty". One can imagine his head spinning for a few seconds, before the reality sunk in that he was no longer the crown prince, but king.