class

Need to get my head around PHP classes

Hello I'm pretty good with PHP, but the one thing I've never understood completely is classes. I've used a few (such as class.upload.php) but have fumbled my way around and more out of a monkey see monkey do approach. Can anyone point me to some good tutorials that explain how these suckers work and how they function? I'd really appr...

results return incorrectly from PHP class query when processed by another function

The following works: $user_list = new user_list(); $all_users_list = $user_list->getAllUsers(); The following doesn't work and I'm unsure as to why it doesn't: $user_list = new user_list(); The above returns: Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, object given on line 59 Classes for reference: c...

[Android] import class/method from java file

I'm currently learning android and java, and I am having some issues with importing a java file. I am working with the time and date example in the android api demos, and I want to put all the code relating to creating the time and date dialogs setting the values etc into a separate java file, and in my main java file run when the appli...

How do I instantiate a class that only has a private parameterless constructor in Silverlight?

I'm working on a feature request for a .NET test data builder. I need to be able to instantiate classes that only have private parameterless constructors. For instance, I might need to instantiate the following class: public class MyClass() { private MyClass(){} } For most other classes I use the following code: (T)Activator.Cr...

Inheritable attributes in ruby classes

Greets to all! I want to describe each kind of product by a class: # Base product class class BaseProduct prop :name, :price # Common properties for all inheritable products end class Cellphone < BaseProduct prop :imei # Concrete property for this product end class Auto < BaseProduct prop :max_speed, :color # Concrete properties...

PHP: How to update a variable of a parent class from a child class

I have a function in a child class which counts the number of SQL queries in a page load In the child class which extends the parent class, after every: mysql_query($query); I put parent::update_query_function(); where update_query_function() is: function update_query_function(){ $this->query_num++; } the $query_num variable in ...

Error : getting an object from an NSMutableArray - objective C

Hi, I have the following code: Product product = [[Product alloc] init]; product.title = tag; [allProducts addObject:product]; NSString *pImage = [[NSString alloc] initWithFormat:p.title]; But it is failing to return anything Can anyone kindly help me please? THanks ...

[DELPHI] Parent class inside another class

Okay, so I have this class, let's say CMain, that contains a CFruit class. What I would like to do is run functions based on CFruit's type (if it's CPear or CApple, etc). So I'd like to do something like this: type CMain = class myFruit : CFruit; function GetFruit() : CFruit; procedure SetFruit( Fruit : CFruit ); end; proced...

Ruby reflection question.

I am new to Ruby so forgive me if the question is inconsistent. Can I iterate over class members like through array in Ruby? How do I achieve this? ...

Form is not updating, after custom class event is fired.

I'm having an issue where my main form isn't updating even though I see the event fire off. Let me explain the situation and share some of my code which I'm sure will be horrible since I'm an amateur. I created a class to take in the settings for running a process in the background. I add some custom events in that class so I could us...

Using NSMutableArray in a class

Whenever I try to add something to my array in the method nothing gets added to the array. I'm wanting it to when you press the button it will add a new object to the array. // JBNumberGeneration.h #import <Cocoa/Cocoa.h> @interface JBNumberGeneration : NSObject { IBOutlet NSTextField *displayLabel; int randNum; int level; int i...

compiling crash - using a member function within another member function

Hi, I am attempting a simple time display program in C++. Edited #include <iostream> #include <cstdlib> #include <iomanip> #include <string> using namespace std; class vClock { public: // constructor vClock(int = 0, int = 0); // mutable member functions void set_time(int, int); void time...

A way to implement `String#split!`

Sometimes I need such method, which could change class of its own object. There are String#delete!, #downcase!, #encode!, #gsub!, #strip!, #slice!, etc. They are all trying to change string, but resulting class is anyway still String. And I want a method, which can convert String to Array. Some way to make this: irb(main):082:0> str = "...

resolving class name clashes in java

Hi, I have a situation where I have to load a named class. If there are multiple classes with the same name (say, com.example.myclass) in my class path I have to load both. I am using 'loadClass()' method of my CustomLoader class which derives from java.lang.ClassLoader. I have not changed the behaviour of the parent class but am simpl...

what is the difference between friend function and friend class?

what is the difference between friend function and friend class? and where should be use of friend keyword? ...

Class hierarchy in C#: how to do it correctly? ('friend' keyword wanted)

I have a class: public class MyClass { private List<string> folderList; // .... a lot of useful public methods here..... } Everything is fine. The list of folders is encapsulated, the class is accessible through public methods. OK. Now I need an "options" form that allows a user to choose folders for MyClass. There is a catc...

[DELPHI] Array of procedures inside a class pointing to class method

Hello. I have a class (TExample) and I want to have an array of pointers that point to TExample methods. For example, I'd like to have TExample.ThinkOne and do aPointers[1] := @TExample.ThinkOne or something similar. How can I properly do this? Thanks. ...

How do I figure out that a particular object in an application is no longer in use?

How could I figure out that an object(or objects of a class) is/are not in use and ready to be collected by GC. or how could i get to know that object has no reference while the application is running. (before it gets GCed) ...

Problem implementing pure virtual class in C++

I have the following class: #include <string> #include <stack> #include <queue> #include "map.h" using namespace std; #ifndef CONTAINER_H_ #define CONTAINER_H_ struct PathContainer { int x, y; string path; }; class Container { public: virtual void AddTile(string, FloorTile *) = 0; virtual void ClearContainer() = 0; ...

Is there a best practice for writing maps literal style in Java?

In short, if you want to write a map of e.g. constants in Java, which in e.g. Python and Javascript you would write as a literal, T<String,String> CONSTANTS = { "CONSTANT_NAME_0": CONSTANT_VALUE_0 , "CONSTANT_NAME_1": CONSTANT_VALUE_1 , "CONSTANT_NAME_2": CONSTANT_VALUE_2 , //... } ; is there a Class or any preset Obj...