answersLogoWhite

0

No. When a method is declared static, it is defined outside of any individual class reference.

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

What is the implicit name of the parameter that gets passed into the set method of class in c?

Every non-static member function has a hidden pointer parameter named this which refers to the instance of the class the function was invoked against. For a given class, C, the type of the hidden this pointer is const C* but if the function is declared const, the pointer is const C* const. When referring to any class member, m, from within any non-static member function, this->m is implied.


Do methods reside within an object?

ya methods resides within an object.. because if we declare a method static it can be called by object genration.. and static variables reside in heap known as permanent genration...


What is the purpose of the this operator?

The 'this' pointer is not an operator, it is a special pointer that exists within every instance of a class, and always points to the current instance of that class. It can only be used in non-static methods of the class because static methods do not have a 'this' pointer; static methods can be called even when there is no instance of the class. Whenever an instance method refers to one of its own members (non-static members), the 'this' pointer is implied: int CMyObject::foo() { return( this->bar ); // returns the bar member of this instance. } The 'this' pointer also makes it possible for an instance to compare itself to other instance references (often to ensure they are different instances) as well as to return a reference to itself. The assignment operator cannot be implemented any other way: CMyObject& CMyObject::operator= (const CMyObject & rhs ) { if( this != &rhs ) // check for self-reference bar = rhs.bar; // perform assignment return( *this ); // return a reference to this instance. } The 'this' pointer also allows an instance to pass a reference or pointer to itself to external functions, including the methods of other instances of the same class.


What is seekg?

In C++, seekg is a method/function of the standard fstream library (fstream::seekg()) which allows you to position the 'get' pointer to an arbitrary position within the stream.


Is it possible to define a java static method inside a main method?

Because, the main method is the starting point of the java program and if we need an object of that class even before the main can be invoked, it is not possible. Hence it is declared static so that the JVM Can acess the main method without having to instantiate that particular class


What is an anchor pointer within a marquee?

File


In bluej can there be a method within a method?

No, Java only allows a method to be defined within a class, not within another method.


Static keyword in java?

A Static method in Java is one that belongs to a class rather than an object of a class. Normal methods of a class can be invoked only by using an object of the class but a Static method can be invoked Directly. Example: public class A { ..... public static int getAge(){ .... } } public class B { ..... int age = A.getAge(); } In class B when we wanted the age value we directly called the method using the instance of the class instead of instantiating an object of the class. Tip: A static method can access only static variables. The reason is obvious. Something that is common to a class cannot refer to things that are specific to an object...


Why inline function cannot be static?

Inline functions can be static. However, their usage outside of classes in C++ has been deprecated (a hangover from C). Static member functions are allowed of course, and they can be inline expanded where desired. In C, a static function simply has limited scope within the same translation unit. In C++, unnamed namespaces are the preferred method of achieving the same end.


What are the application of this pointer can you use this pointer in friend function justify?

The this pointer can only be used within nonstatic member functions. Friend functions are not members so they have no access to a this pointer. However, you can pass a specific instance of a class to a function via a class reference argument. To understand how friendship works, first understand that a nonstatic member function has the following properties: 1. It has private access to the class. 2. It is scoped to the class. 3. It must be invoked upon an object of the class (has a this pointer). Static member functions have the first two properties while friend functions only have the first property.


Do a mouse pointer display as a hand with a pointing finger within a worksheet?

Within Excel the mouse pointer can have a lot of different shapes including the hand with the pointing finger. It depends on what is being done.


What is the purpose of 'this' operator in c?

Every instance of a class inherits a 'this' pointer. It always points to the instance itself. Outside of the object you must use the object's variable name to refer to the object, or instantiate a pointer to the object. But from within the object's member methods you must use the 'this' pointer which is instantiated automatically as soon as the object is constructed and falls from scope when the destructor returns. Only non-static member functions have access to the 'this' pointer. There are several uses, however the most important is when checking for self-references, particularly in the assignment operator overload. That is, any member function that accepts a reference to the same class of object should always check for self-references before attempting to mutate the instance. This is particularly important when the class "owns" memory that is dynamically allocated to it. It is also used to return a reference to the current instance from the assignment operator and from any other operator overload or function that must return a reference to the current instance (including the addition and subtraction operators). Both uses can be seen in the following stripped-down example: class MyObject { public: // Assignment operator overload.MyObject& operator= ( const MyObject & obj ){ // Self-reference check. if( this != &obj ){// Assignment code goes here... } // Return a reference to this object. return( *this ); } }; The 'this' pointer can also be used to pass a pointer (this) or reference (*this) to external functions that accept such arguments. It should also be noted that when referring to an instance member from within a non-static member function, the dereferenced 'this' pointer is implied, as in: this->[member_name] Although this usage is never required, there may be times when it can help make your code more readable, or less ambiguous, especially when a member function must handle one or more external instances of the same class.