Computer Science, asked by dheerajkumar21092004, 5 months ago

17. True and false statements about inline function in given C++ code
example is/are (1)Static function of a class can be called by class name
using scope resolution operator i.e. : : (I) Static function can receive both
static and non-static data members of a class (III)Static function is not the
part of an object of a class
O
a) I and II
Ob) I only
O c)I and III
O d) 1, 11 and TH​

Answers

Answered by Jasleen0599
0

Option B)  I only

(1) Static function of a class can be called by class name using scope resolution operator.

  • Even if the class's objects don't exist, the static functions can still be accessible by using the class name and the scope resolution operator. A static member function can only access other static member functions, static data members, and any other functions that are not class members.
  • A function member can be made independent of any specific class object by making it static. Even though the static functions can only be accessed via the class name and the scope resolution operator::, a static member function can be invoked even if the class's objects don't exist.
  • The answer is no, a static function of a class in C++ can only access static variables. Non-static member functions, however, have access to both static and non-static variables. Static functions can only be invoked using the class name since they are not linked to class objects.

#SPJ2

Answered by syed2020ashaels
0

Correct option is B which is I only.

The inline function is one of the important features of C++. So let's first understand why inline functions are used and what is the purpose of inline functions?

For functions that are large and/or perform complex tasks, the overhead of calling the function is usually insignificant compared to the time the function takes to run. However, for small, commonly used functions, the time required to execute a function call is often much longer than the time required to actually execute the function's code. This overhead occurs for small functions because the execution time of the small function is shorter than the switching time.

A static class function can be called by the class name using the scope resolution operator.

  • Even if class objects do not exist, static functions can still be accessed using the class name and resolution operator.
  • A static member function can only access other static member functions, static data members, and any other functions that are not members of the class.
  • A function member can be independent of any particular object of the class by making it static.
  • Although static functions can only be accessed through the class name and the scope resolution operator::, a static member function can be called even if objects of the class do not exist.
  • The answer is no, a static class function in C++ can only access static variables.
  • However, non-static member functions can access both static and non-static variables.
  • Static functions can only be called using the class name because they are not associated with class objects.

Learn more here:

https://brainly.in/question/27308456

#SPJ2

Similar questions