Top "Class-method" questions

Methods that are called on a class instead of on an object.

Meaning of @classmethod and @staticmethod for beginner?

Could someone explain to me the meaning of @classmethod and @staticmethod in python? I need to know the difference and …

python oop static-methods class-method
What is the difference between class and instance methods?

What's the difference between a class method and an instance method? Are instance methods the accessors (getters and setters) while …

objective-c oop methods class-method instance-methods
Calling C++ class methods via a function pointer

How do I obtain a function pointer for a class member function, and later call that member function with a …

c++ function-pointers class-method
Ruby: Calling class method from instance

In Ruby, how do you call a class method from one of that class's instances? Say I have class Truck …

ruby class-method
How to make a class property?

In python I can add a method to a class with the @classmethod decorator. Is there a similar decorator to …

python properties class-method
What is the purpose of class methods?

I'm teaching myself Python and my most recent lesson was that Python is not Java, and so I've just spent …

python class-method
Using super with a class method

I'm trying to learn the super() function in Python. I thought I had a grasp of it until I came …

python class object super class-method
How do I use define_method to create class methods?

This is useful if you are trying to create class methods metaprogramatically: def self.create_methods(method_name) # To create …

ruby metaprogramming class-method
Calling a base class's classmethod in Python

Consider the following code: class Base(object): @classmethod def do(cls, a): print cls, a class Derived(Base): @classmethod def …

python class overriding class-method
What's an example use case for a Python classmethod?

I've read What are Class methods in Python for? but the examples in that post are complex. I am looking …

python class class-method