711 views
0 votes
0 votes
In context of C++, which of the
following is valid statement ?
(1) Friend function of class is
always a member function of
that class.
(2) Value of static data member
cannot be manipulated once
assigned.
(3) Static data member of a class
can be accessed only by static
member function of that class.
(4) Keywords private, protected and
public may appear in any order
and any number of times in a
class

1 Answer

0 votes
0 votes

(3) Static data member of a class can be accessed only by static member function of that class...

 

A friend function is a function that is not a member of a class but has access to the class's private and protected members.

A friend function is declared by the class that is granting access. The friend declaration can be placed anywhere in the class declaration …

Member functions and static members can be defined outside their class declaration if they have already been declared, but not defined, in the class member list... Static data members are class members that are declared using static keywords. ...

Only one copy of that member is created for the entire class and is shared by all the objects of that class, no matter how many objects are created.

It is initialized to zero when the first object of its class is created...

Syntax..

static data_type data_member_name ..

Therefore option 3 is invalid ....

Related questions

0 votes
0 votes
2 answers
1
logan1x asked May 19, 2019
646 views
A default catch block catches,[A]. all thrown objects[B]. no thrown objects[C]. any thrown object that has not been caught by an earlier catch block[D]. all thrown object...
2 votes
2 votes
0 answers
2
Manu Madhavan asked Jan 10, 2018
727 views
Which of the following concepts of OOPS means exposing only necessary information to client?A. EncapsulationB. AbstractionC. Data hidingD. Data bindingAns...
2 votes
2 votes
1 answer
3
go_editor asked Jul 30, 2016
7,392 views
When the inheritance is private, the private methods in base class are _____ in the derived class (in C++)inaccessible accessibleprotectedpublic
1 votes
1 votes
2 answers
4