class

Is it okay to pass a class object to another class? PHP

I am coding my first object factory, and I am wondering if there any any drawbacks to passing one object into another when creating the second object, and then saving the first object within the second for use later? Example: class main { public $connection = array(); // various other useful functions that should be loaded on ...

How can I get class-based objects in JavaScript with jQuery?

I'm trying to move from Prototype to jQuery and there's one last thing I can't figure out how to do in the new library. Here's what I used to do with Prototype: MyClass = Class.create(); MyClass.prototype = { initialize: function(options) { } } Then I could create a new MyClass with: var mc = new MyClass({}); Does jQuery have...

The difference between Classes, Objects, and Instances

What are class, object and instance in the context of java? Please illustrate your answer with examples. ...

Basic php class problem

Bear with me cos I'm new to oop! Is it possible to assign the result of a function to an attribute? This probably doesn't make sense so here's what I think the code might look like! Class b extends a { public $conn= $this->connect(); public function operation() { ...} } connect() is a function from class a that connects ...

AS3: Optimizing Object Memory Size

I have have a class that I wrote, and it seems bigger than it should be. It doesn't extend anything, and has very little going on - or so I thought - but each one is taking up just under 100k100 bytes ( thanks back2dos ). I guess that I don't have a very good understanding of what really affects how much memory an object takes up in AS3...

I can't understand the usage of the normal class libraries of the Java

I'm a beginner at Java Programming. I have the experience that I used DX library for before in C++. The DX library worked with simple functions, but the library of the JAVA does not work with functions. How can I understand Java Class libraries? ...

wpf binding a combobox to an enum nested in a class

I have been going crazy with binding a combobox to an enum typed property of a class, where the enum itself is declared in that same class. I am trying to follow the answer provided here (wpf combobox binding to enum what i did wrong?) Specifically I am using the suggested MarkupExtension code and the matching xaml code. My working c...

PHP\MySql Multiuser System Backend Structure

Hey guys I'm writing a multiple user log in system using PHP and MySql, the way i have done it in the past is to have a central "processing" file that will handle all of the code on the backend, like logging in, messaging other users etc..., I've used forms with hidden fields to define which action to perform in the processing file. he...

PHP Classes: when to use :: vs. -> ?

I understand that there are two ways to access a PHP class - "::" and "->". Sometime one seems to work for me, while the other doesn't, and I don't understand why. What are the benefits of each, and what is the right situation to use either? ...

How to design a class?

I want to I can improve myself, and then I can design a class as a masterpiece. But I don't how to do that, and what rules I should follow? any suggestions? Thanks in advance ! ...

C# Error "The type initializer for ... threw an exception.

Hello, I need help with this error. This error ocours only in some computers. By reading the stack information, there is some problem when I call to this static method("FormatQuery") in static class: using System; using System.Collections.Generic; using System.Data; using System.Diagnostics; using System.IO; using System.Text; using Sys...

flex button event listeners in Class

Hi, I have many buttons in Main.mxml. I'm trying to move the button functionality into a Class and have Event Listeners inside the class respond to Click and call other functions. I have written: Main.mxml <mx:Button x="23.5" y="10" label="checker" click="{goListen()}" /> <mx:Button id="btnT1" x="252.5" y="10" label="t1" /> <mx:Button ...

How do I use a C# Class Library in a project?

Hi, I've created a new Class Library in C# and want to use it in one of my other C# projects - how do I do this? ...

C++ Overriding Methods

I can't figure out what is up with this. I have a Scene class that has a vector of Entities and allows you to add and get Entities from the scene: class Scene { private: // -- PRIVATE DATA ------ vector<Entity> entityList; public: // -- STRUCTORS --------- Scene(); // -- PUBLIC METHODS ---- void ad...

Does using properties on an old-style python class cause problems

Pretty simple question. I've seen it mentioned in many places that using properties on an old-style class shouldn't work, but apparently Qt classes (through PyQt4) aren't new-style and there are properties on a few of them in the code I'm working with (and as far as I know the code isn't showing any sorts of problems) I did run across ...

Setup Default Location Doubt

Hi , How to change the [TARGETDIR] of my setup project programatically when i use Installer Class Please help me urgent..... ...

Classes nested in functions and attribute lookup

Hi all! The following works Ok, i.e. it doesn't give any errors: def foo(arg): class Nested(object): x = arg foo('hello') But the following throws an exception: def foo(arg): class Nested(object): arg = arg # note that names are the same foo('hello') Traceback: Traceback (most recent call last): File "...

C#: Encapsulation of for example collections

I am wondering which one of these would be considered the cleanest or best to use and why. One of them exposes the a list of passengers, which let the user add and remove etc. The other hides the list and only let the user enumerate them and add using a special method. Example 1 class Bus { public IEnumerable<Person> Passengers { ...

PHP Global Variables

I have a database class, which an instance is declared in the main index.php as $db = new Database(); Is there a way for the $db variable to be globally recognized in all other classes without having to declare global $db; in the constructor of each class? ...

Java generized class reference

If you have a method with the signature: Class<? extends List<String>> getObjectType() { return ?????; } How do you return a proper generic version of the List class? return List.class; //errors return List<String>.class; //errors return List.class<String>; //errors what is the proper syntax to handle this? ...