A friend function is used in object-oriented programming to allow access to private or protected data in a class from outside the class. Normally a function which is not a member of a class cannot access such information; neither can an external class. Occasionally such access will be advantageous for the programmer; under these circumstances, the function or external class can be declared as a friend of the class using the friend keyword.

PropertyValue
dbpprop:abstract
  • A friend function is used in object-oriented programming to allow access to private or protected data in a class from outside the class. Normally a function which is not a member of a class cannot access such information; neither can an external class. Occasionally such access will be advantageous for the programmer; under these circumstances, the function or external class can be declared as a friend of the class using the friend keyword. The function or external class will then have access to all information – public, private, or protected – within the class. This procedure should be used with caution. If too many functions or external classes are declared as friends of a class with protected or private data, necessary data security may be compromised, as well as the encapsulation of separate classes in object-oriented programming.
dbpprop:date
  • May 2009
dbpprop:hasPhotoCollection
dbpprop:reference
dbpprop:wikiPageUsesTemplate
rdf:type
rdfs:comment
  • A friend function is used in object-oriented programming to allow access to private or protected data in a class from outside the class. Normally a function which is not a member of a class cannot access such information; neither can an external class. Occasionally such access will be advantageous for the programmer; under these circumstances, the function or external class can be declared as a friend of the class using the friend keyword.
rdfs:label
  • Friend function
owl:sameAs
skos:subject
foaf:page
is owl:sameAs of