Top "Class-method" questions

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

Access Class method and variable using self

In below example Test class has two instance method and one classmethod In set_cls_var_1 method I set class …

python python-2.7 class class-method class-variables
ActiveRecord Rails 3 scope vs class method

I'm new to the new query interface of ActiveRecord so I'm still figuring things out. I was hoping someone could …

ruby-on-rails-3 activerecord class-method scopes
How to dynamically define a class method which will refer to a local variable outside?

class C end var = "I am a local var outside" C.class_eval do def self.a_class_method puts …

ruby dynamic closures class-method local-variables
How to understand the difference between class_eval() and instance_eval()?

Foo = Class.new Foo.class_eval do def class_bar "class_bar" end end Foo.instance_eval do def instance_…

ruby class-method instance-method
What does 'self' refer to in a @classmethod?

I thought I was starting to get a grip on "the Python way" of programming. Methods of a class accept …

python self class-method
Python - why can I call a class method with an instance?

New to Python and having done some reading, I'm making some methods in my custom class class methods rather than …

python python-2.7 inheritance class-method
Python __init__ and classmethod, do they have to have the same number of args?

So classmethods can be used as an alternative "constructor" in python, they are bound to the class and not to …

python oop constructor arguments class-method
Swift Declare Class Func in Protocol

I had following confusion. As far as I know the main difference between static and class keywords when declaring method …

ios swift protocols static-methods class-method
In Ruby, inside a class method, is self the class or an instance?

I know that self is the instance inside of an instance method. So, then, is self the class inside of …

ruby class instance self class-method
Class methods which create new instances

Apart from the standard [[MyClass alloc] init] pattern, some objects are built from static methods like MyClass *obj = [MyClass classWithString:@"…

objective-c memory-management class-method initializer