You will find an explanation here.
Overlay:
When you overlay a component in AEM, it means copying the component from folder /libs/to folder /apps/... And you can overlay your own definitions (e.g. change name, group, business logic functionality) on newly copied components in/apps/..
According to OSGIβs preferences, by default, AEM uses the search path to search for a resource, first searches for a branch /apps/and then a branch /libs, so your newly copied components in /apps/take precedence over /libs/.
Note that we can change the search path and its priority order by changing it from the Felix console of the Apache Sling Factory Resource Solver .
libs/foundation/components/ , , , .. , jsp .
, , sidekick, /apps/.., , componentGroups /libs/.., (foundation) vs (your project).

Override:
/ sling:resourceSuperType.
sling:superResourceType /libs/, .
sling:superResourceType , ( projectA ProjectB .., lib).
AEM 6.0 Granite Touch, Adobe 
Sling:
Sling Resource Merger . Sling (org.apache.sling.resourcemerger), , . (.. Overlay Override).
Sling
sling: hideProperties (String String []) - . * .
sling: hideResource (Boolean). , , .
sling: hideChildren (String String []). node , . node .
* .
sling: orderBefore (String). sibling node, node.
AEM , Felix org.apache.sling.resourcemerger
Sling Resource Merger AEM :
AEM,
node jcr:title, , /libs/ /apps



jcr:title overlay node, /apps/..

libs
sling Resource Merger
, , node jcr:title, sling:hideProperties, .

.

. , .