Many people say that gerunds are ing verbs used as nouns. While that may be offensive to some, in fact, the statement is quite true: They are verbs; they always end in ing; but they are used as a noun. Because they are nouns, they can be subjects, direct objects, indirect objects, objects of the preposition, or predicate nominatives:
Cooking is fun. (subject)
I enjoy cooking. (direct object)
The audience gave Emeril's cooking enthusiastic applause. (indirect object)
After cooking, Tom took a nap. (object of the preposition)
His hobby is cooking. (predicate nominative)
Remember that you must use the "question key" when you are trying to identify the subject, direct object, etc. Remember this key:
Who?/What? + verb = subject
Subject + verb = direct object
Subject + linking verb = predicate nominative
Subject + verb + direct object + to/for Whom?/What? = indirect object
Preposition + ing gerund = object of the preposition
Since GERUNDS are ing verbs used as nouns, they maintain their verb-like qualities which means that a gerund can also take a direct object.
A gerund and a direct object are referred as a GERUND PHRASE. In order to determine whether or not the gerund has a direct object, place the interrogative pronouns Whom?/What? after the gerund. If you get an answer, then the gerund has a direct object:
Hearing that song reminded him of the childhood memories of yesteryear.
Hearing + Whom?/What? = song (song is the direct object of the gerund)
Your primary objective with gerund phrases is to isolate the phrase from the rest of the sentence. Once you have done that, then go through the "key" to find out if the gerund functions as a subject, direct object, indirect object, object of the preposition, or a predicate nominative:
Hearing that song...