Log In
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
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

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.


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.

Related questions

0 votes
1 answer
If a function is friend of a class, which one of the following is wrong ? A function can only be declared a friend by a class itself. Friend functions are not members of a class, they are associated with it. Friend functions are members of a class. It can have access to all members of the class, even private ones.
asked Sep 24, 2016 in Object Oriented Programming makhdoom ghaya 900 views
0 votes
1 answer
A function template in C++ provides _____ level of generalization. $4$ $3$ $2$ $1$
asked Sep 24, 2016 in Object Oriented Programming makhdoom ghaya 897 views
3 votes
1 answer
Which of the following differentiates between overloaded functions and overridden functions ? Overloading is a dynamic or runtime binding and overridden is a static or compile time binding. Overloading is a static or compile time binding and overriding is dynamic or ... in a derived class is called function overloading, while redefining a function in a friend class is called function overriding.
asked Jul 20, 2016 in Object Oriented Programming makhdoom ghaya 1k views
1 vote
1 answer
Member of a class specified as ______ are accessible only to method of the class. Private Public Protected Derive
asked Sep 15, 2016 in Object Oriented Programming makhdoom ghaya 1.2k views