Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on Query with relation to member function and object in Class within the C and C++ forums, part of the Software Development category; Is it possible to create member function in a class without using or without creating an object? If so in what scenarios can one achieve this also tell me if ...
|
|||||||
|
|||
|
Query with relation to member function and object in Class
Is it possible to create member function in a class without using or without creating an object? If so in what scenarios can one achieve this also tell me if this concept is possible is this used in real time applications.
|
| Sponsored Links |
|
|||
|
Re: Query with relation to member function and object in Class
I fail to understand how Harsha'a post came here... I could see he's new here... Kindly can eny of the moderators delete/move that post which is irrelevant for the discussion?
|
|
|||
|
Re: Query with relation to member function and object in Class
Yes. You can use static funstions for this purpose. Static functions should be used without having an instance of the class. Here's an example.
Quote:
Kalayama |
|
|||
|
Re: Query with relation to member function and object in Class
Kalayama thanks for you reply. I understood that static function is used for the query I asked.But could you tell me why we need such concept or in other words in what scenarios would we use these.
|
|
|||
|
Re: Query with relation to member function and object in Class
Well, I personally have used this feature to handle exception in multi-threaded programs.
There are a number of other possible usages for static functions. (I remember answering the same question in Geek interview, may be in Q&A or FAQ section. Search for it, might have written more there) PS: Too little time mate, will post a detailed reply soon
__________________
[COLOR="Blue"][SIZE="2"]"If you are not living on the edge of your life, you are wasting space"[/SIZE][/COLOR] Someone says "Impossible is nothing". The man next him says "Let me see you licking your elbow tip!" |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|