class

C++ inherited class has member of same name

hello, in c++ you can put a member in a base class and a member with the same name in the inherited class. how can i access a specific one in the inherited class? thanks! ...

[PHP] using the magic __set() method with 2D arrays

If I have the following registry class: Class registry { private $_vars; public function __construct() { $this->_vars = array(); } public function __set($key, $val) { $this->_vars[$key] = $val; } public function __get($key) { if (isset($this->_vars[$key])) retur...

Java: exception-throwing class?

I have classes DirReader and Search. The search uses DirReader. I want the search to know when DirReader throws exception. So how can I have class throwing exception? Currently, I use initCorrect -dummy var. Exception-style method may be more appropriate. Simplified Example Error $ javac ExceptionStatic.java ExceptionStatic.java:4: '...

Can't declare even the most simple class in PHP - Am I going insane?

I'm getting this error whenever I attempt to declare a class: Parse error: syntax error, unexpected T_VARIABLE, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home3/foundloc/public_html/booka/page2.php on line 7 (line 7 is the class declaration by the way). Here's the incredibly simple class I am attempting to declare: Cl...

ActionScript - clicking and determining the sprite's class

i'd like to add all or most of my mouse events to stage, but in order to do that i need to be able to tell what is the type of the sprite being clicked. i've added two sprites to the display list, one of which is from a class called Square, the other from a class called Circle. var mySquare:Sprite = new Square(); var myCircle:Sprite = ...

Coding an array in a class library and make a call to it C#

I'm new to C#, so this may be a basic question. What I need to do is put an array such as the one below in a class library and then make a call to it. So I'd want the appropriate picture to appear via the class and this array. I know there's a much simpler way to make certain pictures appear, but this is a requirement for the project. It...

how to pass an id number string to this class

I'm very much a vb person, but have had to use this id number class in c#. I got it from http://www.codingsanity.com/idnumber.htm : using System; using System.Text.RegularExpressions; namespace Utilities.SouthAfrica { /// <summary> /// Represents a South African Identity Number. /// valid number = 7707215230080 /// inva...

How to repaint another Qt class

Hi all, I'm a new bit in Qt... I have a Qt GUI application (written by me), let's call it QtAPP.exe When QtAPP.exe running, I will use a QThread and QProcess to execute some external file, such as player.exe (written in native C). Here's my question: In QtAPP.exe, there are 2 classes, 1. QMainWindow - Core of QtAPP.exe 2. QThread - A t...

C++ return a "NULL" object if search result not found

I'm pretty new to C++ so I tend to design with a lot of Java-isms while I'm learning. Anyway, in Java, if I had class with a 'search' method that would return an object T from a Collection< T > that matched a specific parameter, I would return that object and if the object was not found in the collection, I would return a NULL. Then in m...

class, dict, self, init, args ?

class attrdict(dict): def __init__(self, *args, **kwargs): dict.__init__(self, *args, **kwargs) self.__dict__ = self a = attrdict(x=1, y=2) print a.x, a.y b = attrdict() b.x, b.y = 1, 2 print b.x, b.y Could somebody explain the first four lines in words? I read about classes and methods. But here it seems very co...

Quick question on using the constructer with multiple files.

Hi there, I have this class header //header for class. #ifndef Container_H #define Container_H #include <iostream> using namespace std; const int DEFAULT=32; class Container{ public: Container(int maxCapacity = DEFAULT); ~Container(); void insert(int item, int index); void erase(int index); ...

How to share a static variable between C++ source files?

Hello, I don't know if it is possible to do this, but I have tried several ways and nothing seems to work. Basically I need to access the same static member from several files which include the same class definition. // Filename: S.h class S { public: static int foo; static void change(int new_foo) { foo = new_foo; ...

AS3: How to dispatch from the document class?

I have a pretty good handle on dispatching from classes other than the Document Class, but what happens when I want to dispatch an event from the Document class and have other classes listen to the document class broadcast? It seems like there are several ways to approach this (i.e using a Singleton, using composition, using MovieClip(r...

Class vs. Module in VB

What advantage is there, if any, to using Modules rather than classes in VB? How do they differ, and what advantages/disadvantages are there in using modules? In VB or VB.NET, I use both. ...

Watir question regarding exist on a class for testing purposes.

I have a button on my page that changes depending on what radio button is clicked. The button has the same text on it with the same id, but different classes. How do I test if the two different buttons exist depending on the radio. <a id="submit" class="on" href="javascript:submit();">Submit</a> <a id="submit" class="off" href="javascri...

Getting progress reports from a layered worker class?

I have a layered worker class that I'm trying to get progress reports from. What I have looks something like this: public class Form1 { private void Start_Click() { Controller controller = new Controller(); controller.RunProcess(); } } public class Controller { public void RunProcess() { Th...

python remove everything between <div class="comment> .. any... </div>

Hi how do you use python 2.6 to remove everything including the <div class="comment"> ....remove all ....</div> i tried various way using re.sub without any success Thank you ...

Why does forward declaration not work with classes?

int main() { B bb; //does not compile (neither does class B bb;) C cc; //does not compile struct t tt; //compiles class B {}; //HERE is the class B defination struct s { struct t * pt; }; //compiles struct t { struct s ...

friendship and operator overloading help

hello there, I have the following class #ifndef Container_H #define Container_H #include <iostream> using namespace std; class Container{ friend bool operator==(const Container &rhs,const Container &lhs); public: void display(ostream & out) const; private: int sizeC; // size of Container int capacityC; ...

WPF: How to create a new class of user control in runtime?

Hello! I need to define a user control in runtime and then instantiate it wherever I want. So it should not be just a "new UserControl()" (that will be an instance of a UserControl class) but the one I can use as a template. Should I use reflection to generate new type or is there a better way? Thanks! ...