class

Populate an Array of Object Based on DataReader Data

Hi. I am not sure how to phrase my question properly but I want to achieve something like this. I have a class named Products public class Products private ID as Integer private Name as String Public Property ProductID() Get Return ID End Get Set(ByVal value) ID = value End Set End Property In one of my code behin...

What's the most interesting wrong view people have on the difference between structure and class in C++?

What's the most interesting wrong view people have on the difference between structure and class in C++? ...

[PHP] Are namespaces really all that useful in frameworks?

As far as I can tell, the only reason we have namespacing in PHP is to fix the problem of classes (+ functions & constants) clashing with others classes of the same name. The problem is that most frameworks setup their autoload and filesystem hierarchy to reflect the names of the classes. And no-one actually require()s or include()s fil...

Override or remove an inherited constructor

Here is some C++ code: #include <iostream> using namespace std; class m { public: m() { cout << "mother" << endl; } }; class n : m { public: n() { cout << "daughter" << endl; } }; int main() { m M; n N; } Here is the output: mother mother daughter My problem is that I don't want the m's constructor to...

Inner class modifying owning class's attribute

I have a code like this: class Foo() { time_to_play = 0 class Bar() { void change_player() { //I need something HERE } } } And I need to change the attribute time_to_play from class Foo, but make this change from inside the method change_player(), that is under class Bar. I cannot declare clas...

jQuery create an array of objects with a specific class

Is there an array created somewhere of all the objects with a specific class? I want to find the sixth div with class="clCategory". Is there something like: $('.clCategory:sixth').css(...); or $('.clCategory')[6].css(...); Or do I have to create the array at the same time I programmatically create each of the DIVs with class="cl...

How can I inherit an inner class using an abstract base class?

I'm trying to create a test class which organizes its test methods using inner classes. I would like for this class to be abstract with the ability to set a static property so this property can be injected. Here's an example of what I'm talking about: [TestClass] public abstract class BaseUnitTest { public static string InjectedPro...

When I work with PHP classes nothing happens...

Below is some code I've been trying, and I've messed about with it to include die()'s and echo()'s here and there but nothing happens, if I try running someone else's class code with instances of the objects it works fine, but I can't see what's wrong with my code. class Form { private $form_method; public function __construc...

Associative Array where a class TypeInfo is key in D?

I'd like to be able to create an multidim associative array where one dimension is a class. Like this: class Node{ Node[?classType?][string] inputs; } so that I later can do Node[] getInputsOfType(?? aClass){ if(aClass in this.inputs) return this.inputs[aClass]; else return null; } // meanwhile in another file....

.NET class prefix and postfix naming conventions

Developer teams usually have some class naming conventions based on class functionality and roles it plays in patterns. For example, we use the following postfixes: Info for data structure classes (only public properties, no methods, such as business entities). Helper for classes with common functionality used all over the project (S...

Have a WPF Control Class being a template class

Hey, is there a way to have a WPF UserControl Class to be a class with a Template type? e.g. public partial class MyControl : UserControl should be: public partial class MyControl<MyData> : UserControl as I always get compile errors that MyControl than has no reference to InitializeComponents which is in the automatic generated pa...

Java - Design advice for simple game

Hey, I'm implementing a simple "Play your cards right" (otherwise known as higher/lower) game. In case you've not come across it before the rules are really simple. A single suit of cards (e.g. hearts) are used. One card is drawn at a time and the objective is to correctly guess if the face value of the next card will be higher or lower...

Understanding Java applets

Hi, I am trying to understand how applets work. I understand that a class file is bytecode, something that a JVM can understand and execute. When an applet runs on the user's system, the bytecode is transferred to the user system over the network. Now, what happens when there are more than one class files? For example, what if the cl...

Function call in variable declarations

Hi, A couple of questions If I declare a variable in a class, class A, as private int blah = myclass.func(); When is the func() actually called? The first time class A is initiated? If I have public final int blah = myclass.func(); I know that somehow blah is dynamically updated (e.g. everytime I call some other function in cla...

How to make my data structure thread safe?

I defined an Element class: class Element<T> { T value; Element<T> next; Element(T value) { this.value = value; } } also defined a List class based on Element. It is a typical list, just like in any data structure books, has addHead, delete and etc operations public class List<T> implements Iterable<T> { ...

Flash, ActionScript 3: using get/set properties to get values from other classes creates much duplicate code can it different?`

hi, i am using get and setters in my as3 code to edit values of an other class (because those variables are shared) i dont like to put stage.sharedVar.isScrabble in my code every time to change a variable so i used get/set functions see below private function get isScrabble(){return stage.sharedVar.isScrabble;} private function set i...

Requirements for directly returning a class instance from a function?

I'm got a function in C++ that wraps an output stream constructor so it can pass in a pointer to a parent class that it's running in, ala: pf_istream PF_Plugin::pf_open_in() { return pf_istream(this); } When I do it that way, however, I get something like this: pf_plugin.cc:103: error: no matching function for call to ...

How to use an overridden constant in an inheritanced class

Hey, given this code: class A CONST = 'A' def initialize puts CONST end end class B < A CONST = 'B' end A.new # => 'A' B.new # => 'A' I'd like B to use the CONST = 'B' definition, but I don't know how. Any ideas? Greetings Tom ...

What are the most common uses of static class functions in C++?

I am learning today about static class functions in C++ and I can't really understand what are they good for? Does anyone have some good examples where they can be applied successfully? Thanks, Boda Cydo. ...

Exposing existing class library to WCF service

Hi guys, I have an existing class library with all the classes to communicate with my server. I've created a WCF service that will be hosted on my existing server as part of different application domain. Since I already have the classes I thought it can be exposed on my WCF service to lessen my development time. I successfully hosted m...