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.

Passing variables, creating instances, self, The mechanics and usage of classes: need explanation

I just rewrote a working program into functions in a class and everything messed up. First, in the __init__ section …

python class call parameter-passing instance-variables
'namespace' but is used like a 'type'

This is my program the class uses it is called Time2 I have the reference added to TimeTest I keep …

c# class namespaces
Java: how do I get a class literal from a generic type?

Typically, I've seen people use the class literal like this: Class<Foo> cls = Foo.class; But what if …

java generics class literals
How do you implement a class in C?

Assuming I have to use C (no C++ or object oriented compilers) and I don't have dynamic memory allocation, what …

c class oop embedded
Pointer to class data member "::*"

I came across this strange code snippet which compiles fine: class Car { public: int speed; }; int main() { int Car::*pSpeed = &…

c++ class pointers c++-faq
How to create a template function within a class? (C++)

I know it's possible to make a template function: template<typename T> void DoSomeThing(T x){} and it's …

c++ templates function class
How to synchronize a static variable among threads running different instances of a class in Java?

I know that using the synchronize keyword before a method brings synchronization to that object. That is, 2 threads running the …

java multithreading synchronization class object
Why use 'virtual' for class properties in Entity Framework model definitions?

In the following blog: http://weblogs.asp.net/scottgu/archive/2010/07/16/code-first-development-with-entity-framework-4.aspx The blog contains the following code sample: public …

c# class properties virtual
Calling a class function inside of __init__

I'm writing some code that takes a filename, opens the file, and parses out some data. I'd like to do …

python class
How to get elements with multiple classes

Say I have this: <div class="class1 class2"></div> How do I select this div element? …

javascript class element