in Object Oriented Programming
720 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
in Object Oriented Programming
720 views

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 ....

1 comment

question is about valid
0
0

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