class

What does "const class" mean?

After some find and replace refactoring I ended up with this gem: const class A { }; What does "const class" mean? It seems to compile ok. ...

Class design: Wrapping up a datafile into a class with respect to thread-safety and testability.

I'm writing an app in C# (.net 3.5) and I have a question about class design: I'd like to create a class which accesses a file (read, write) and provides its content to the users (instanciators) of the class. The most common operation on an instance will be to retrieve a certain value from the file. The actual read and write (io) opera...

Domain Modeling or class diagram for car dealership

I am trying to draw a domain model or class diagram in UML for car dealership. I am stuck with how to present test drive in the model. One way is to have appointment class and then test-drive as sub class. A dealer also offers after-sale vehicle service so i could have appointment/booking class as super class and then vehicle service an...

Can you create an ASP.NET editing system for a class just by defining it?

I was watching a tutorial on Rails and was very impressed that you could so easily create an editing system for a class just by defining it. Can this be done in ASP.NET? I know there are ORMs out there, but do they come with an editing system? To explain what I mean by an editing system, consider a class for defining people class Per...

Pros and cons of using nested C++ classes and enumerations?

What are the pros and cons of using nested public C++ classes and enumerations? For example, suppose you have a class called printer, and this class also stores information on output trays, you could have: class printer { public: std::string name_; enum TYPE { TYPE_LOCAL, TYPE_NETWORK, }; class out...

Force .NET webservice to use local object class, not proxy class

I have a webservice that I'm calling from a windows forms application (both .NET, both in the same solution), and I'd like my webservice to return a custom object from elsewhere in the project - it's a common object that they both share a reference to, as it's in the third project in my solution. When I call the webservice, it returns a ...

Interface Contract, Class Object?

Is contract to interface as object is to class? What is the need to differentiate identical things like this, from the code to the executing code? I sort of get the idea behind naming a class a class and the instantiated executing class an object, but overall, is that the only reason for these semi-redundant terms? ...

Private and Protected Members : C++

Can someone enlighten me as to the difference between private and protected members in classes? I understand from best practice conventions that variables and functions which are not called outside the class should be made private - but looking at my MFC project, MFC seems to favour protected. Whats the difference and which should I use...

Eclipse class version bug

In eclipse 3.4 I'm trying to do some performance tests on a large product, one of the included libraries is the vecmath.jar (javax.vecmath package) from the Java3D project. Everything was working fine and then when trying to run it yesterday I get this exception/error not long after starting it up: java.lang.UnsupportedClassVersionErro...

Java - Abstract class to contain variables?

Is it good practice to let abstract classes define instance variables? public abstract class ExternalScript extends Script { String source; public abstract void setSource(String file); public abstract String getSource(); } The sub class, ExternalJavaScript.class, would then automatically get the source variable but I fe...

C++ Nested classes driving me crazy...

i am trying to compile this very simple piece of code class myList { public: std::vector<std::string> vec; class Items { public: void Add(std::string str) { myList::vec.push_back(str); }; }items; }; int main() { myList newList; newList.items.Add("A"); } what can i do to make this work ...

How to best visualize a "permission Matrix" in an UML class diagram?

For the sake of simplicity: There is a permission based system in place with different kinds of user levels and actions (think: UNIX file system permissions) What would be the best approach to visualize this in UML? ...

java.lang.Exception vs. rolling your own exception

At what point would you create your own exception class vs. using java.lang.Exception? (All the time? Only if it will be used outside the package? Only if it must contain advanced logic? etc...) ...

When to Use Static Classes in C#

Here's what MSDN has to say under "When to Use Static Classes": static class CompanyInfo { public static string GetCompanyName() { return "CompanyName"; } public static string GetCompanyAddress() { return "CompanyAddress"; } //... } Use a static class as a unit of organization for methods not associated with parti...

How does the Gaia Flash Framework access the scaffold.as file?

In the Gaia Flash Framework, a file called 'Scaffold.as' is used to make each page a scaffold page. This is accessed by the code, new Scaffold(this); But the class itself does not appear to be imported. Am I missing something about the way flash handles external classes? Or is there something else pulling it in? Any help appreciated....

c++ class friend

Hi, I'm trying to compile such code: #include <iostream> using namespace std; class CPosition { private: int itsX,itsY; public: void Show(); void Set(int,int); }; void CPosition::Set(int a, int b) { itsX=a; itsY=b; } void CPosition::Show() { cout << "x:" << itsX << " y:" << itsY << endl; } class CCube { fri...

Can callback methods in PHP's session_set_save_handler be private?

I am writing a custom session handler in PHP and trying to make the methods defined in session_set_save_handler private. session_set_save_handler( array('Session','open'), array('Session','close'), array('Session','read'), array('Session','write'), array('Session','destroy'), array('Session','gc') ); For exampl...

c++ adding method to class defined in header file

I'm wondering if it is possible to add methods in main program to an existing class defined in header file. For example: There is class CFun defined in file CFun.hpp, but in our party.cpp we want to add a method void hello() {cout << "hello" << endl;};without editing CFun.hpp Obviously (unfortunately) construction: #include "CFun.hpp" ...

Class Constructor never executed in release mode.

Exactly what the title says. I'm using MSVC++ 2008 express, and my class constructor is never executed when compiled in release mode. It DOES work in debug mode. I am doing something like: ClassTest test; test.DoIt(); Breakpoints on DoIt(); trigger, but breakpoints on ClassTest::ClassTest(); do not. ...

What is a good design pattern in C# for classes that need to reference other classes?

I am working on a business problem in C#.NET. I have two classes, named C and W that will be instantiated independently at different times. An object of class C needs to contain references to 0 ... n objects of class W, i.e. a C object can contain up to n W objects. Each W object needs to contain a reference to exactly 1 object of cla...