answersLogoWhite

0

This depends a little bit on your language, but in a sense all functions defined outside a class are static, if your language allows them at all (C++ does, Java does not) A static member is a member that is not tied to a particular instance of a class.

Typically a static method (it's called a method, not a function when it's part of a class) is used when you want to allow access to a method without requiring an instance of the class to be created. For example, all the methods of the Java Math object are static. You don't ever create an instance of the Math class. Instead, you refer to the entire class: Math.round(), for example. The static method is still defined inside the class. It can be called without an instance of the class being available.

The most common static method (at least in Java) is main() It needs to be static because it is called before any classes are instantiated. Usually it is used to 'bootstrap' the program by instantiating its own class.

In C++, the static members will have a scope outside the class instance, so they should be prototyped like any other top-level function. Prototyping isn't absolutely necessary, but it makes it much easier to write your code as you don't have to worry about the order in which things are written.

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

Should discussions held within the EMC be shared with those outside the group?

All opinions, remarks and comments, discussed within the confines of the EMC, will remain as part of this group unless explicitly authorised by all of the EMC members."


When you should tape gagged girl?

Never! Unless, possibly, if she has explicitly asked for it.


Where should you bathe a dog?

u should bathe it outside


should you go and play outside when it is raining outside?

no


How can a browser history get deleted when I did not delete it?

No it cannot get deleted automatically. The history should be cleaned explicitly by the user.


how long should a person be outside?

A person should be outside 15 to 20 minutes a day.


what field is used as a primary key?

We explicitly choose a primary key.A primary key should satisfy the following conditions: 1) it should not be null 2) it should be unique.


Should the shower curtain cover the shower head?

No, the shower curtain should not cover the shower head. Ideally, the curtain should hang inside the bathtub or shower stall to prevent water from splashing outside while allowing the shower head to function properly. This setup ensures effective water containment and minimizes the risk of water damage to the bathroom area outside the shower.


Should I kill spiders or should I pick them up and take them outside where they belong?

Put the spider outside. It's where it should belong. It has a family...


Do pit bulls live outside?

No dogs should live outside.


What is the rate of change of a linear function?

It will just be the gradient of the function, which should be constant in a linear function.


Your outside cat just had kittens and its really hot outside what should you do?

You should get it in side befor it gets to hot and dyes