class

How do you create a static class in C++?

How do you create a static class in C++? I should be able to do something like: cout << "bit 5 is " << BitParser::getBitAt(buffer, 5) << endl; Assuming I created the BitParser class. What would the BitParser class definition look like? ...

What's the difference between struct and class in .Net?

I'm looking for a clear, concise and accurate answer. Ideally as the actual answer, although links to good explanations welcome. ...

How to handle including needed classes in PHP

I'm wondering what the best practice is for handling the problem with having to "include" so many files in my PHP scripts in order to ensure that all the classes I need to use are accessible to my script. Currently, I'm just using includeonce to include the classes I access directly. Each of those would includeonce the classes that the...

Classes vs 2D arrays

Which is better to use in PHP, a 2D array or a class? I've included an example of what I mean by this. // Using a class class someClass { public $name; public $height; public $weight; function __construct($name, $height, $weight) { $this -> name = $name; $this -> height = $height; $this -> weight = $weight; } } $classArra...

Classes in VB6

Yeah, I'm stuck maintaining some legacy software. Does anyone know of any good tutorials on creating classes and whatnot in VB6? My Google-fu seems to be failing me. :-/ ...

Why/when should you use nested classes in .net? Or shouldn't you?

In Kathleen Dollard's recent blog post, she presents an interesting reason to use nested classes in .net. However, she also mentions that FxCop doesn't like nested classes. I'm assuming that the people writing FxCop rules aren't stupid, so there must be reasoning behind that position, but I haven't been able to find it. ...

When should you use a class vs a struct in C++?

In what scenarios is it better to use a struct vs a class in C++? ...

Old style and new style classes in Python

What is the difference between old style and new style classes in Python? Is there ever a reason to use old-style classes these days? ...

C++ function pointers and classes

ok say I have void Render(void(*Call)()) { D3dDevice->BeginScene(); Call(); D3dDevice->EndScene(); D3dDevice->Present(0,0,0,0); } This is fine as long as the function I want to use to render is a function or static class method Render(MainMenuRender); Render(MainMenu::Render); However I really want to be able to use...

Class definition, using { get; set;}

In the past we declared classses like: public class MyClass { private int _age; public int Age { get{ return _age; } set{ _age = value; } } } Now we can do: public class MyClass { public int Age {get; set;} } My question is, how can I access the private variable that is created automatical...

java package cycle detection: how to find the specific classes involved ?

What tool would you recommend to detect java package cyclic dependencies, knowing that the goal is to list explicitly the specific classes involved in the detected 'across-packages cycle' ? I know about classycle and JDepend , but they both fail to list the classes involved in a cyclic package dependency. Metrics has an interesting grap...

Should I use clone when adding a new element? When should clone be used?

I want to implement in Java a class for handling graph data structures. I have a Node class and an Edge class. The Graph class maintains two list: a list of nodes and a list of edges. Each node must have an unique name. How do I guard against a situation like this: Graph g = new Graph(); Node n1 = new Node("#1"); Node n2 = new Node("#...

How do you make a deep copy of an object in Java?

In java it's a bit difficult to implement a deep object copy function. What steps you take to ensure the original object and the cloned one share no reference? ...

Classes in Python

In Python is there any way to make a class, then make a second version of that class with identical dat,a but which can be changed, then reverted to be the same as the data in the original class? So I would make a class with the numbers 1 to 5 as the data in it, then make a second class with the same names for sections (or very similar...

Valid characters in a Java class name

What characters are valid in a Java class name? What other rules govern Java class names (for instance, Java class names cannot begin with a number)? ...

Can you have a Class in a Struct

Is it possible in C# to have a Struct with a member variable which is a Class type? If so, where does the information get stored, on the Stack, the Heap, or both? ...

Static class variables in Python

Is it possible to have static class variables or methods in python? What syntax is required to do this? ...

Defining class methods in PHP

Is it possible in PHP (as it is in C++) to declare a class method OUTSIDE the class definition? ...

Other file doesn't recognizes other file's class C++

Hello, I have my own class inside the file "Particles.h" and the class's implementation is inside "Particles.cpp" and I want the file "Load.h" to recognize my classes inside there,so I've added the line #include "Particles.h" and the file doesn't recognizes it,and at the past everything was ok(I havn't made any changes inside that clas...

Open Java *.Class Files

I'm trying to figure out what a Java applet's Class file is doing under the hood. Opening it up w/ Notepad or Textpad just shows a bunch of gobbley-gook. Any way to wrangle it back into a somewhat readable format so's I can try to figure out what it's doing? Environment == Windows w/ VS 2008 installed. ...