Computer Science, asked by branlyquize, 11 months ago

differentiate between static Member function and a Member function which is not static​

Answers

Answered by somalia31
1

Answer:

static member function can access static variables but nonstatic member function cannot access static variables

Answered by Jasleen0599
2

differentiate between static Member function and a Member function which is not static

  • Even when a class is not instantiated, a static member function can be called. The class's this pointer cannot be accessed by a static member function. One must be careful not to declare a static member function as virtual when declaring a non-static member function as virtual.
  • The static member functions are unique functions that can be used to access other static member functions or static data members.
  • The keyword static defines a member function. Any number of the class' objects may share a static member function's single copy of the member function.
  • When a resource (variable, method), also known as one that is used by multiple objects, is in shareable mode, the tatic keyword is used. A single copy of a resource will be created for all objects if it is made static. A variable, method, block, and inner class can all be made static. Static variables are linked to classes. When a class is loaded into the method region of the memory area by the JVM, static resources are initialized.
  • Static methods have scope at the class level and are initialized when the JVM loads the class into the method area. Non-static methods, however, acquire memory after an object has been created. They are worried about the class instance. We do this because of this.

#SPJ3

Similar questions