
OneDefinitionRule(ODR)
(1)Inany(single)translationunit,atemplate,type,function,orobject,cannot
havemorethanonedefinition
-Compilererrorotherwise
-Anynumberofdeclarationsareallowed
(2)Intheentireprogram,anobjectornon-inlinefunctioncannothavemore
thanonedefinition
-Multipledefinitionslinkingerrorotherwise
-Entitieswithinternallinkageindifferenttranslationunitsareallowed,eveniftheir
namesandtypesarethesame
(3)Atemplate,type,orinlinefunctions/variables,canbedefinedinmorethan
onetranslationunit.Foragivenentity,eachdefinitionmustbethesame
-Undefinedbehaviorotherwise
-Commoncase:sameheaderincludedinmultipletranslationunits
31/54