class

Problem in adding a class element to an element.

I'm trying to remove a class attribute from an element and add the class to another element. I successfully removed the class but having problem in appending the class to the other element. When I click the link 'View All', <a class="code_link" id="viewAllMyForms" href="#" >View All</a> This function is called.I want to remove the c...

Using .class files in Eclipse for Java Developers

For a Java class assignment I was given a file named LogReader.class to use. How can I make Eclipse recognize that this compiled class exists so that I can use it? I tried putting it into my src folder but that did not work. I'd rather not go back to compiling with the command line. I do not have access to the source of LogReader.cla...

Imported a class and make it part of my game

Hello all I was hoping to get some help with inported this class to a little game AS3 allowDomains:Array is a list of the allowed domains My Question is where an how to write this Array and where to place it so all get compiled with Flash CS4. class below. package com.ikonicstudios.utils { import flash.display.DisplayObject; ...

How to aggregate all attributes of a hierarchy of classes?

There is a hierchy of classes. Each class may define a class variable (to be specific, it's a dictionary), all of which have the same variable name. I'd like the very root class to be able to somehow access all of these variables (i.e. all the dictionaries joined together), given an instance of a child class. I can't seem to find the way...

Dynamically attaching a method to an existing Python object generated with swig?

I am working with a Python class, and I don't have write access to its declaration. How can I attach a custom method (such as __str__) to the objects created from that class without modifying the class declaration? EDIT: Thank you for all your answers. I tried them all but they haven't resolved my problem. Here is a minimal example tha...

C++ Inheritance/VTable questions

Update: Replaced the destructor example with a straight up method call example. Hi, If I have the following code: class a { public: virtual void func0(); // a has a VTable now void func1(); }; class b : public a { public: void func0() { a::func0(); } void func2(); }; Is there a VTable in B? B has no virtual functio...

DO I need to create a new object to use a classes functions more then 1 time on a page?

I currently call a function to filter some HTML in PHP like this FilterHTML($string) I found a CLASS that I would like to use though and I do not know much about OOP and classes at all. I would like to just use this class in my existing function call because the function is already called sitewide in a lot of file so I would like to ...

Class design: allow a class to be used both as an object and also supply public static methods

I have a silly, little class "FileSystemSize" which can be used both as an object and also via public, static methods. The output is similar, but not identical in each case. The class was intially static, but I added the possibility to initialize it as an object to allow extending with new "convenience methods" in future versions, witho...

How to make a proper mysqli extension class with prepared statements?

I have scoured the web for a good example but I can't find anything. I am trying to extend the mysqli class to make a helper class that will abstract away some of the complexities. One of the main things I want to accomplish is to make use of prepared statements. I don't really know where to start, or how to handle input and output p...

C# Update Form from threading & class

I working on project and have problem with threading and update of UI. I read many post around web and this site, but didnt find answer to my problem. I making program that a waiting for some UDP data on port XXXX. Looping in separated thread. When data come he extract information and put it in buffer, and go back wait another data. Ano...

C++: Hide base static member

In C++, is it possible to have a child class "hide" a base class' static fields and methods? (i.e. A has a field named ABC of type int, B:A and B has a field named ABC of type int) ...

Python: Automatically initialize instance variables?

Hi, I have a python class that looks like this: class process: def __init__(self, PID, PPID, cmd, FDs, reachable, user): followed by: self.PID=PID self.PPID=PPID self.cmd=cmd ... Is there any way to autoinitialize these instance variables, like C++'s initialization list? It would spare lots of r...

In Perl are there disadvantages to generating getters and setters rather than hard-coding them?

In the example module below, the getters and setters are generated by adding anonymous subroutines to the symbol table. After the methods have been created in this manner, will the resulting code be functionally equivalent (in terms of behavior, speed, etc.) to a module with manually-written getters and setters, or does this approach hav...

Event/Class Design Pattern (Prototype)

I've bumped up against this before and I need the help of someone smarter than me! How can I attach an event of an element to a method of a class? More specifically, the same class? Is there a better way? Using a Qt widget style approach, I've been trying to create self-contained "widget" objects in javascript. I'm using the Prototype...

Doing pointer math in a c++ class: Is it "legit"?

Ah-hoi, hoi, I'm wondering if it's ok to do something like the following: class SomeClass { int bar; }; SomeClass* foo = new SomeClass(); int offset = &(foo->bar) - foo; SomeClass* another = new SomeClass(); *(another+offset) = 3; // try to set bar to 3 Just Curious, Dan O ...

Can I autoload function files without classes in PHP?

My site is pretty large and I do not use PHP Classes, I do not understand OO good enough yet to re-write my site to use them however I would really like to use the __autoload($class_name) feature that classes use. I rely a lot on functions, I have different function files, forums.inc.php blogs.inc.php user.inc.php photos.inc.php general...

Is there a way to synthesize setters/getters for class variables in Objective-C?

I find myself declaring bunch of class variables and it is really tiring to write simple get/set methods for each variable. So, the question is how to synthesize setters/getter for class variables in objective-c? ...

Calling a Variable from another Class (C#)

How can I call a variable from a public class to another public class in C#. I have: public class Variables { static string name = ""; } I need to call it from: public class Main { } Thanks for help in advance. Working in a Console App. ...

PHP: Use variable name to call static function on Singleton Object

I need to call a static function from an object using the Singleton design, but using a variable as the class name. The best way, $class::getInstance();, is only available in PHP 5.3, and the other way I found, call_user_func(array($class, 'getInstance'));, results in the maximum execution time being breached. Does anyone know why this ...

how do I make this function a class?

hi everybody, i've been creating functions for too long without taking my code to 'classes'. I learn well through example and I just wanted to convert this simple function into a class so I can compare something I know with something I don't... Take the following function: function affiliateName($affiliateID) { $sql = 'SELECT * FROM ...