class

Can singleton class be static?

Hi, Can singleton class be static? ...

C++ Mingw: Two objects of the same class are changing the data across eachother.

I am a newbie. Using class clsMRDateTime and am creating 2 instances of objects in the main code. When I activate the line: clsMRDateTime objMRDateTimeURL("10_05_2011");//THIS CAUSES THE PROBLEM!!!!! It causes the date in the first instance of the class to match the second instance of the class. I checked for static class var...

trying to update an array element in java

I'm trying to update an array element in Java. Some sort of a database like program, but using an array to store data temporarily. The code seems to be working only on the first array element which is 0. If I try to search for other records, it cannot find them. I don't know why. boolean blnFound=false; String strP=getString("Inpu...

PHP Date Recurrence Library?

Ruby, Java, and Python all have several very good libraries which allow you to handle rfc2445's rrule very well. I've done an extremely comprehensive search for a class/library which will handle the rrule and return dates of recurrence, however I haven't found 1 library in PHP will do it. I am going to begin to write a PHP library whic...

Creating two separate instances from the same class causes them to be linked together?

The problem I am having is I create two different menus from a single class. When I finish the first one, everything is fine. However when I create the second one and set it's region, it modifies the previous one as well. When I call Display() which just flips a boolean variable, it flips it for both instead of just the one I'm calling t...

VB.NET - Alias to class' properties

I have an object and I iterate over object's properties. Foreach property, i append it as a column to a listview. In my object, some properties doesn't have accents. But in portuguese, they do. For example: "Endereco" property must be "Endereço". I need an away to create an alias to the properties. Is it possible in VB.NET? Thank you. ...

Gethashcode() function

Why aren't C1 and c2 have the same hashcode ? the code doesn't get to "Same".... ( i=0 in both classes) class myclass { public static int i; static void Main() { myclass c1 = new myclass(); myclass c2 = new myclass(); if (c1.GetHashCode() == c2.GetHashCode()) Console.Write("Same"); ...

c++ winsock code does not work in its original solution/project in visual studio 2010

Hey... I am not 100% sure if I shall become insane... As mentioned in many many other posts, I am writing this Connection class which stats up winsock, creates some sockets, binds them and let´s you send and receive some data... I made this within my Server-project... But , everytime i wanted to test the connection part of the server ...

Is there a built in way to identify instances of a class?

I am doing some diagnostic logging with one of my C#.NET projects and I would like to be able to log an identifier that represents a specific instance of a class. I know I could do this with a static variable that just gets incremented every time a class instance is created but I am just wondering if there is any built-in way in the .NET...

Scala: Filtering based on type

I'm learning Scala as it fits my needs well but I am finding it hard to structure code elegantly. I'm in a situation where I have a List x and want to create two Lists: one containing all the elements of SomeClass and one containing all the elements that aren't of SomeClass. val a = x collect {case y:SomeClass => y} val b = x filterNot ...

Objective-C call function on another class?

Hello, Here are my objective-c classes: AppDelegate SomeScript How might I call the function loggedIn on the SomeScript class from the app-delegate or any other class? Thanks, Christian Stewart ...

How to remove a SPAN create with APPEND() ?

hellooo, I have this code BOX and After: $(".boxAlert").click(function(){ $(this).remove(); //$(this).fadeOut(500); }); It's OKAY, when I click on the SPAN with class boxAlert, it removes it. But I can not remove the SPAN's I created this way.. $('#myDiv').append('Invalid Mail'); The SPAN I create this way ...

C++: Can a struct inherit from a class?

I am looking at the implementation of an API that I am using. I noticed that a struct is inheriting from a class and I paused to ponder on it... First, I didn't see in the C++ manual I studied with that a struct could inherit from another struct: struct A {}; struct B : public A {}; I guess that in such a case, struct B inherits f...

PHP - returning multiple states, not just true/false

Hi, how is everyone? I have a conceptual problem to do with PHP classes and error handling.. Below is a basic class demonstrating my issue. A function to create a database record exists named "domain_create". This function calls a secondary function to ensure that the domain to be created does not already exist within the database ta...

Access Other Entity Collections from Entity Partial Class

I have an entity class that has a property that contains a business code. I would like to add a property that will contain the description of that business code. To do this it will require that I query another entity collection, but the entity collection doesn't seem to be accessible in the partial class of the entity. I can't solve t...

Is it a good idea to using class as a namespace in Python

I am putting a bunch of related stuff into a class. The main purpose is to organize them into a namespace. class Direction: north = 0 east = 1 south = 2 west = 3 @staticmethod def turn_right(d): return turn_to_the_right @staticmethod def turn_left(d): return turn_to_the_left # defined a short alias because ...

PHP exceptions - do i have the correct idea?

Hi everyone, i am trying to understand the use of exceptions in PHP.. How they work and when to use them... The basic structure below, is the the correct method.. It seems somewhat bloated to me? Thanks in advance for any advise or help.. <?php class APIException extends Exception { public function __construct($message) { ...

what's the difference between abstract and interface in php?

Possible Duplicate: PHP: What is the difference between an interface and abstract class? hi guys.. As far as I understand, a clase implements or extends abstract or interface class has to use the default methods. I know we can use implement keyword to use multiple interfaces, but we only can extend 1 abstract. Can anyone expl...

Passing type of template function to template class used within it?

I am trying to build a template function. Inside templated classes are used and I would like to pass the template type of the function to those classes. So I have: template <class T> T find_bottleneck (ListGraph &g, CrossRefMap<ListGraph, Edge, T> &weight, Node &s, Node &t) { // Check if theres a single edge left if (countEdge...

What's required to implement root class of Objective-C?

I tried this code: // main.m #import <stdio.h> @interface Test + (void)test; @end @implementation Test + (void)test { printf("test"); } @end int main() { [Test test]; return 0; } with LLVM/Clang without any framework, it doesn't compiled with this error: Undefined symbols: "_objc_msgSend", referenced from: _ma...