what is the use of static functions, whre it is use,pls give ne detailed infor mation?
static functions
Collapse
X
-
Tags: None
-
Originally posted by sreenadh494what is the use of static functions, whre it is use,pls give ne detailed infor mation?
Try to Google on it.
You will better explanation than me.
If still you find difficult to understand then come here with your specific Problem.
Kind regards,
Dmjpro. -
A static member function can access only static member data, static member functions and data and functions outside the class. It can be called, even when a class is not instantiated.Originally posted by sreenadh494what is the use of static functions, whre it is use,pls give ne detailed infor mation?
Regards
PS: I think you are preparing for some exams ( by just seeing your questions I think ). I suggest you better search on google. You will get many informative sites discussing these issues. Still doubts, feel free to ask here :)Comment
-
For C: a static function is a function that can only be called from other functionsOriginally posted by sreenadh494what is the use of static functions, whre it is use,pls give ne detailed infor mation?
in the same translation unit (read: source file after everything has been #included).
For C++: see C, but also a static member function is a function that belongs to
a class, not to a particular instance (object) thereof. The C-ish usage is a bit
obsolete nowadays; the anonymous namespace is used instead.
kind regards,
JosComment
-
There are many uses of static functions and variables in c++. Static variables are used in monostate patterns, in which all the instance of a class needs to refer to same variable.Originally posted by sreenadh494what is the use of static functions, whre it is use,pls give ne detailed infor mation?
Static functions are used in singleton pattern and there is a good article in this forum by weaknessforcats .
Other uses are passing function pointers to a system call or function written in c.Comment
Comment