And here is how it sounds:
This is just the root and fifth of a simple progression in C major: I ii V I. This kind of bass line would be suitable for a polka or any kind of traditional dance. The player might ornament it a bit here and there with some rhythmic variations or by adding some passing notes. But the basic idea is just to provide a foundation. This kind of bass line would work with just about any melody, which is why I call it "generic". I think you can hear how it works in this traditional polka. The bass has a lead-in and a few decorations between phrases but for the most part it just keeps hitting the root and fifth of the chords:
I'm certainly not an expert on the many kinds of bass lines we find in current popular music, but let me pick one example to demonstrate a "composed", i.e. not generic, bass line. Pretty much everything Paul McCartney does on the bass is pretty interesting, but a real stand out is the bass line to "Penny Lane". We have to look at it in relation to the melody. Here are the first four measures with the melody and bass. One distinctive thing about this bass line is that it starts very high and descends for the whole four measures. In order not to use a lot of ledger lines, the sign 8va meaning "at the octave (higher)" is used:
It starts by outlining the tonic chord, B major, then descends by step until the second full measure where it outlines the dominant chord, then the scale descent continues. This is just the first phrase; there are lots of good bass lines in the rest of the song:
Notice how measures of "walking" bass lines are alternated with measures of held notes for variety.
Classical music also has its generic and composed bass lines. Perhaps the most inventive composer of bass lines was J. S. Bach. They sometimes just support the harmony, as in the beginning of the theme to the Goldberg Variations:
But more often than not the bass line is almost as important as the soprano voice as we can see and hear in the first fugue from the Well-Tempered Clavier where all four voices are equal:
Rather than each voice having a particular function: the soprano the melody, the bass the foundation and the middle voices for filling in the harmony, each voice is a completely independent melody, including the bass.