To take material or an original idea from another author and claim it as your own is considered to be unethical and maybe plagiarism. But in classical music, to take a theme or an idea of music from another composer and then to quote [use] that theme and develop it in your work is considered as honoring the original composer.
The great German Romantic composer Johannes Brahms honored many of his fellow composers by using their themes and employing them in his many theme and variations pieces. Brahms composed variations on themes by Handel, Haydn, Paganini, and his mentor and friend Robert Schumann. Johannes Brahms was a brilliant composer in his own right and did not need to take musical ideas from other composers because of a lack of his own original music ideas. He did so because of his love and respect of these composers and he showed that adoration by developing their original themes with his variations to make many pieces of great beauty.
In the theme and variations mode, the piece will always start with the original theme, then have numerous variations of that theme and usually return to the original theme in the final variation.
Johannes Brahms [1833 – 1897]
My favorite Brahms variations is his “Variations on a Theme by Haydn”. The theme of Haydn is the St. Anthony Chorale. St. Anthony Chorale was a hymn tune [by unknown traditional composers] that Haydn used in his Divertimento #1 in Bb Major. It was the second movement of that divertimento-andante. So, you see while Brahms borrowed it from Haydn, Haydn also borrowed this hymn for his use.
Brahms variations has 10 movements, starting with the Chorale St. Anthony theme in andante and the finale [with the original theme repeated at the very end] andante.
Please turn up the volume to listen first to the St. Anthony Chorale theme Haydn used in his divertimento, and then Brahms variations on that theme by Haydn. You will hear how the original theme used by Haydn is so beautiful and how Brahms takes that beautiful theme to develop it into an even greater beautiful piece of his own.
Franz Joseph Haydn: St. Anthony Chorale Theme:
Johannes Brahms: Variations on a Theme by Haydn: