The Gateway to Computer Science Excellence
+3 votes

Which of the following is not a member of class ? 

  1. Static function
  2. Friend function
  3. Const function
  4. Virtual function 
in Object Oriented Programming by Boss (30.7k points)
recategorized | 2.8k views

2 Answers

+2 votes

A friend function of a class is defined outside that class' scope but it has the right to access all private and protected members of the class. Even though the prototypes for friend functions appear in the class definition, friends are not member functions. A friend can be a function, function template, or member function, or a class or class template, in which case the entire class and all of its members are friends.

Hence,Option(B)Friend Function.


by Boss (41.2k points)
0 votes
In a class, the private data can be accessed only by the public member function of that class. c++ provides a mechanism in which a non member can have access to the private member of a class. This is achieved by the non_member function "friend" to the class, whose private data can be accessed.
by (59 points)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,291 answers
104,890 users