| | |
Concept Clarification
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
•
•
Hai everyone
I need a clarification on the following issue
Why does C++ compiler doesn't allow, to initialize static member function inside a class
And please do tell me about what is meant by initializing a function (member function)
Please help me in getting it clear
thank you
Have a nice day
Jas.
Last edited by JasonHippy; Apr 24th, 2009 at 5:48 am. Reason: smelling pistake / typo / got me m***ing fords wuddled
There are 10 types of people in this world.....
Those who understand binary .....
And those who don't!
Those who understand binary .....
And those who don't!
>>initialize static member function
>>initializing a function
These two things doesn't mean anything in C++. You don't initialize a function. You initialize an object ( or a variable, whatever you call them).
Things you can do with functions are:
Declare them
Define them
Call them
Overload them
Templatize them
May be more but I just cannot think of them right now.
There is no thing as initializing a function (or member function)
>>initializing a function
These two things doesn't mean anything in C++. You don't initialize a function. You initialize an object ( or a variable, whatever you call them).
Things you can do with functions are:
Declare them
Define them
Call them
Overload them
Templatize them
May be more but I just cannot think of them right now.
There is no thing as initializing a function (or member function)
Siddhant Sanyam
(Not posting much)
My Blog: Yatantrika
Migrate to Standard C++ :When to tell your C++ Code is Non-Standard.
Please Read before posting: How To Ask Questions The Smart Way
(Not posting much)
My Blog: Yatantrika
Migrate to Standard C++ :When to tell your C++ Code is Non-Standard.
Please Read before posting: How To Ask Questions The Smart Way
•
•
•
•
>>initialize static member function
>>initializing a function
These two things doesn't mean anything in C++. You don't initialize a function. You initialize an object ( or a variable, whatever you call them).
Things you can do with functions are:
Declare them
Define them
Call them
Overload them
Templatize them
May be more but I just cannot think of them right now.
There is no thing as initializing a function (or member function)
Typically you'd usually use a public static member function as an external interface to your class...
In other words, they can be called from outside of the class and also without there necessarily being an active instance of the class!
For example if you had a singleton object, you'd usually include a public static member function in it's class definition to return a pointer to the one and only instance of the object (which could be stored in the class as a private static object, or as a static object in the class's namespace).
That way if other external classes/objects need to be able to access/use your singleton, they have a means to access it.
Offhand I can't think of any practical examples for protected/private static functions...But I'm sure some of the more experienced programmers on here can expand on this!
Cheers for now,
Jas.
There are 10 types of people in this world.....
Those who understand binary .....
And those who don't!
Those who understand binary .....
And those who don't!
![]() |
Similar Threads
- Array syntax issue (C#)
- Arrays and Pointer Arithmetic Question (Computer Science)
- Arrays and Pointer Arithmetic Question (C)
- Help Understanding Constraints (Database Design)
- Clarification in Classes (C++)
- Needs clarification about Serialization concepts (Java)
- Why do people wish for tableless with CSS? (HTML and CSS)
- javascript scroller not scrolling properly (JavaScript / DHTML / AJAX)
Other Threads in the C++ Forum
- Previous Thread: HashTable
- Next Thread: Friend function & member function name collision
| Thread Tools | Search this Thread |
api application array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer dll dynamiccharacterarray email encryption error file format forms fstream function functions game generator getline graph homeworkhelper iamthwee ifstream image input int java lib list loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg simple sorting string strings template text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






