answersLogoWhite

0


Best Answer

Static function are function only visible to other function in same file Function outside the class can access, useful whenever we need to have functions which are accessible even when the class is not instantiated.

User Avatar

Wiki User

16y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

10y ago

A atom consist out of 2 parts where as the centre is called the nucleus which is form out of Protons and neutrons and the outer part that orbits the nucleus is Electrons. Protons is positively charged, Electrons is negatively charged and neutrons well you guessed it, its neutral. When 2 or more objects that is not earth bound is in constant contact or rubbed against each other, the Electrons from one of the objects is transferred to the other object and thus that object has more Electrons than Protons and thus it has a negative charge and the other object has a positive charge as it has no more Protons than Electrons. Protons doesn't normally get transferred from object to object as it is normally held firm to the Atom. Opposite objects attract each other while the same charge repel each other but a neutral object will attract both positive and negative charged objects. When a charged object is in contact with a different charged object a discharge will take place and thus static electricity will take place.
Static menu: All patrons are offered the same foods every day. Once a static menu is developed and established, it rarely changes. Static menus are typically found in fast-food operations, ethnic restaurants, steakhouses and the like. Static menus can also be in institutional settings. For example, a static menu at an elementary school could offer students, along with vegetable and dessert, the same luncheon choices every school day: a cheeseburger, fish sticks, chicken tacos, Pizza wedges or a sandwich.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

A static method is a method which belongs to a class, rather than an object; calling a static method does not require you to first create an instance of the class and can not access any non-static members of the class.

A static class is an inner class which is treated as a top-level class.

A static function in C is a function which is not public, ie not available from other source files.

This answer is:
User Avatar

User Avatar

Wiki User

8y ago

A static class is simply a class which cannot be instantiated. That is, it has no constructors and therefore cannot be created, copied, moved or destroyed. All members of a static class (methods and data) must be declared static. Static classes are typically used to group a set of related functions and data together under a common name.

A static member function is a class member function that is declared static. They are local to the class rather than local to an object of the class. They are easier to understand if you consider that an ordinary (non-static) member function has the following three properties:

  1. The function can access the private part of the class declaration.
  2. The function is in the scope of the class.
  3. The function must be invoked on an object of the class.

A static member function has the first two properties only. For completeness, a friend function has the first property only.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

A static function in class scope (within a class) can access only static class members (for all instances of the class).  A static function in file scope (not within a class) is visible only to code within that compilation unit, i.e. it cannot be linked from file to file.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is static function and static class?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How do you differentiate between a member function and normal function?

A normal function is any function that is not a member of any class. Normal functions that operate upon a class are referred to as non-member functions, however a non-member function can also be a member of another class. Any class may declare any non-member function to be a friend of the class, in which case the function becomes a friend function.A member function is a member of a class and may be declared static or non-static. Non-static member functions have the following 3 properties:Private access to the class members.Scoped to the class.Must be invoked against an object of the class (has a 'this' pointer).Static member functions have the first two properties only while friend functions have the first property only. Non-member functions that are not friends of the class have none of these properties.


What facility static gives in class?

Static variables or function provides global view to the application that is u can access a static variable with one or more than one objects of a single class without loosing i.e. reinitializing its value.


What is the function of static relay?

function of static relay


What is the use of private constructor in c plus plus?

Private construction prevents objects from the class from being instantiated other than via a static member function of the class, a friend function or a friend class.


What is the difference between normal function and static function in c plus plus?

When a function is declared static at file scope, this means the function has internal linkage only. That is, the function is only accessible to the translation unit in which it is declared. This applies to both C and C++. However, we can achieve the same thing in C++ by declaring a (non-static) function in an un-named (anonymous) namespace. Whether this better represents internal linkage or not is merely a matter of taste. In C++ we can also declare static functions inside a class. Static member functions differ from non-static member functions in that they do not have access to a 'this' pointer; they are local to the class, not to objects (instances) of the class. As such, they can be invoked without having to instantiate an object from the class.

Related questions

What is the Use of static function?

A static function is a member function that is not associated with any instance of the class; it has no this pointer.


What is the pupouse of static function?

A static function, not part of a class, is visible only to other code within the same compilation unit, i.e. the same source file. A static function, part of a class, can only operate on static class data, which is per class data as opposed to per instance data.


How many static function can declare in one class?

It is dependent on the requirement of your usage of the Object of that class


How do you differentiate between a member function and normal function?

A normal function is any function that is not a member of any class. Normal functions that operate upon a class are referred to as non-member functions, however a non-member function can also be a member of another class. Any class may declare any non-member function to be a friend of the class, in which case the function becomes a friend function.A member function is a member of a class and may be declared static or non-static. Non-static member functions have the following 3 properties:Private access to the class members.Scoped to the class.Must be invoked against an object of the class (has a 'this' pointer).Static member functions have the first two properties only while friend functions have the first property only. Non-member functions that are not friends of the class have none of these properties.


How do you call static methods without using objects?

You can call a static method via an object; the other alternative is to use the class name. A common example is the following, to calculate the exponential function: Math.exp(x) Here, exp() is a static function in the class Math. Note that the class name is used instead of an object.


How is memory allocated to the private-data member function when an object is not created during the calling process?

A class can have both static and non-static data. Static data is local to the class while non-static data is local to each object of the class. It makes no difference whether static data is global, local to a file, local to a function or local to a class (whether public, protected or private), all static data is allocated within the program's data segment along with all constants. As such they are allocated at compile time.


Is a static member function similar to a friend function?

No. To understand how friend functions relate to static functions you first need to understand the three qualities of a normal member function (an instance member function): 1. The function has access to the private aspects of the class in which it is declared. 2. The function is scoped to that class. 3. The function must be invoked on or from within an object of that class. A static function only has the first two qualities (so no instance of the class is required) while a friend function only has the first quality (so is neither scoped to the class nor requires an instance of the class). All three share the first quality only but that alone does not make them similar. It is the qualities they lack that sets them apart.


What do you understand by keyword 'this'?

"this" can only be used within the body of a non-static member function of a class and refers to the current instance of that class. Typically, we only refer to "this" instance when a non-static member function returns a reference to the current instance.


What is static class?

A static class is a class where all the members are declared static.


Why static functions cannot use instant variables?

Static functions are tied to a class, not to a particular object. A static function can only access static variables because it has no knowledge of member variables.


What facility static gives in class?

Static variables or function provides global view to the application that is u can access a static variable with one or more than one objects of a single class without loosing i.e. reinitializing its value.


What is the function of static relay?

function of static relay