|
-
March 31st, 1999, 09:29 PM
#1
Static Class and Static function
Hi;
Just want to know who can i directly call and use a function from a class
without object or pointer. I heart it can be done bye Static class and static
function. ANyone tell me how to start with this?
Thanks...
-
March 31st, 1999, 11:13 PM
#2
Re: Static Class and Static function
You can use static functions just like you would use a global function. They are very similar.
-
March 31st, 1999, 11:13 PM
#3
Re: Static Class and Static function
You can use static functions just like you would use a global function. They are very similar.
-
March 31st, 1999, 11:14 PM
#4
Re: Static Class and Static function
to invoke a method without creating an instance of the class you need to
define the method as static. This makes the method belong to the class and
not to the individual objects of the class.
The _best_ way to use this static method is to use it without creating an
instance of the class, using <your_classname>::<your_method>
.
class your_classname {
public:
static void your_method();// static method declaration
//...
);
.
void main(){
your_classname::your_method();// static method invocation
//...
}
-
April 1st, 1999, 01:33 AM
#5
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|