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 virtual destructor? Explain the use of it?

758


Is swift faster than go?

888


Describe the advantage of an external iterator.

808


How a new element can be added or pushed in a stack?

795


What are the uses of pointers?

799


What does int * mean in c++?

963


What is the operator in c++?

871


What is implicit conversion/coercion in c++?

984


Define 'std'.

917


What is static class data?

787


What is a binary file? List the merits and demerits of the binary file usagein C++.

970


What is lambda in c++?

893


What happens when the extern "c" char func (char*,waste) executes?

862


What is null and void pointer?

807


What is the difference between a definition and a declaration?

822