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.

How to read the value of a private field from a different class in Java?

I have a poorly designed class in a 3rd-party JAR and I need to access one of its private fields. …

java class reflection field private
Why is enum class preferred over plain enum?

I heard a few people recommending to use enum classes in C++ because of their type safety. But what does …

c++ class enums c++-faq
How to invoke the super constructor in Python?

class A: def __init__(self): print("world") class B(A): def __init__(self): print("hello") B() # output: hello In all …

python class inheritance constructor superclass
Call a Class From another class

I want to call class2 from class1 but class2 doesn't have a main function to refer to like Class2.main(…

java class selenium selenium-webdriver call
What is the difference between "Class.forName()" and "Class.forName().newInstance()"?

What is the difference between Class.forName() and Class.forName().newInstance()? I do not understand the significant difference (I have …

java class object instantiation
Mockito match any class argument

Is there a way to match any class argument of the below sample routine? class A { public B method(Class&…

java class mockito arguments matcher
Expression must have class type

I have't coded in c++ for some time and I got stuck when I tried to compile this simple snippet: …

c++ class new-operator
Java: Multiple class declarations in one file

In Java, you can define multiple top level classes in a single file, providing that at most one of these …

java class
Private properties in JavaScript ES6 classes

Is it possible to create private properties in ES6 classes? Here's an example. How can I prevent access to instance.…

javascript class ecmascript-6 private-members es2015
What is the difference between __init__ and __call__?

I want to know the difference between __init__ and __call__ methods. For example: class test: def __init__(self): self.a = 10 …

python class oop object callable-object