What is the use of static functions?

Answer Posted / anh vu

A static function member can be used to provide utility
functions to a class. For example, with a class representing
calendar dates, a function that tells whether a given year
is a leap year might best be represented as a static
function (DateTime.IsLeapYear). The function is related to
the operation of the class but doesn't operate on particular
object instances (actual calendar dates) of the class.

Is This Answer Correct ?    15 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a stack c++?

572


What is public, protected, private in c++?

657


Why null pointer is used?

581


Why Pointers are not used in C++?

624


What is the use of :: operator in c++?

599






What is helper in c++?

573


How do you find out if a linked-list has an end? (I.e. The list is not a cycle)

601


what are the iterator and generic algorithms.

1687


We use library functions in the program, in what form they are provided to the program?

599


Difference between struct and class in terms of access modifier.

695


Explain the difference between class and struct in c++?

590


Is c++ a high level language?

552


Explain all the C++ concepts using examples.

686


Specify some guidelines that should be followed while overloading operators?

618


Comment on c++ standard exceptions?

638