Top "Class" questions

A template for creating new objects that describes the common state(s) and behavior(s). NOT TO BE CONFUSED WITH CSS CLASSES.

Getting attributes of a class

I want to get the attributes of a class, say: class MyClass(): a = "12" b = "34" def myfunc(self): return self.a …

python python-2.7 class attributes
Declaring static constants in ES6 classes?

I want to implement constants in a class, because that's where it makes sense to locate them in the code. …

javascript class constants ecmascript-6
Can we instantiate an abstract class?

During one of my interview, I was asked "If we can instantiate an abstract class?" My reply was "No. we …

java oop class object abstract
What is the difference between Integer and int in Java?

For example why can you do: int n = 9; But not: Integer n = 9; And you can do: Integer.parseInt("1"); But not: …

java class int
How do I get a PHP class constructor to call its parent's parent's constructor?

I need to have a class constructor in PHP call its parent's parent's (grandparent?) constructor without calling the parent constructor. // …

php class oop inheritance constructor
Declaring an enum within a class

In the following code snippet, the Color enum is declared within the Car class in order to limit the scope …

c++ class enums namespaces scope
Can I extend a class using more than 1 class in PHP?

If I have several classes with functions that I need but want to store separately for organisation, can I extend …

php class oop extends
Beginner Python: AttributeError: 'list' object has no attribute

The error says: AttributeError: 'list' object has no attribute 'cost' I am trying to get a simple profit calculation to …

python list class dictionary attributeerror
jquery, find next element by class

How can i find the next element by class. i tried with $(obj).next('.class'); but this returns classes …

jquery class element next
What is the difference between old style and new style classes in Python?

What is the difference between old style and new style classes in Python? When should I use one or the …

python class oop types new-style-class