class

how do i access static member of a class?

Hi guys, I am trying to access static member of a class. my class is: class A { public static $strName = 'A is my name' public function xyz() { .. } .. } //Since i have bunch of classes stored in an array $x = array('A'); echo $x::$strName; I am getting error while printing. How can i print 'A is my name'...

PHP: declare a class variable to be a stdClass object

This is probably pretty simple but I haven't been able to figure out how to phrase the question for Google, so here goes: So, I often do something like this... class foo { private $bar = array(); } ... to set some class property to be an array. However, I'd like to make a private property an object instead, something like this: ...

How to access an object from another class?

Hello, I have a DB class, which is used to make select, update, delete mysql queries. Now, I want to create a mysql query inside another class, but if I define $db = new DB(); in index.php, I can't use the $db var in another class. Do I have to define the variable $db over and over again, if I want to make a query? Or is there a way to...

Getting information about a class with NSLog

When I first started learning XCode I remember hearing something about how it has cool features to inspect an object and get information about its class. Now I need to use these cool features. How can I use NSLog to get class information about an object and other cool information about an object. ...

Class Private members modified on creating a structure (C++)

I was just going through some codes of C++. Where in I came across the concept of reinterpret_cast operator. EDIT 1 : I know that accessing private members of a class is not recommended. But in some situations we ought to go ahead and access them. I have just put forth this question to get my concepts clear. In the example that I re...

Using classes from an other namespace/page in C#

Hi all, In my project I have 2 main files - a C# Windows Service that uses Quartz.NET (using a database rather than RAM based scheduling) for scheduling and actually running the jobs, and an ASP.NET (using C#) backend for adding jobs to the Quartz.NET scheduler. All job 'types' are defined in the Windows Service file, so when I try to a...

Location of python string class in the source code

I'm looking into overloading the '+' operator for a certain string so I was thinking of subclassing the string class then adding the code in the new class. However I wanted to take a look at the standard string class first but I can't seem to find it... stupid eh? Can anyone point the way? Even online documentation of the source cod...

does order of members of objects of a class have any impact on performance?

May order of members in binary architecture of objects of a class somehow have an impact on performance of applications which use that class? and I'm wondering about how to decide order of members of PODs in case the answer is yes since programmer defines order of members via order of their declaraions ...

Trying to make a program that imitates a Process Table

Hello,I am trying to create a program that is just like a Process Table. I have to implement a class PCB (Process Control Block) with several fields such as:process name (a string) process priority (an integer) register set values (an object of a class Register Set containing the following fields: XAR, XDI, XDO, PC. Then my program ne...

When will the "jar" command refuse to add a class to a .jar file?

Hi. I have 204 total classes (most of the classes are inner classes). For months, I have been building fine with SCons (SCons just calls the jar command). For some reason, it stopped adding the last inner class for a particular class. For example, suppose I have the following classes: class1 class2 class3 class4 class5 class6 ... cl...

Compilation error: `Class' does not name a type

Hi, I have a pretty simple class called simulator in simulator.h #include <iostream.h> #include <stdlib.h> Class Simulator { private: short int startFloor; short int destFloor; public: void setFloors(); void getFloors(short int &, short int &); }; Now when I compile it, I get this error: ...

(Usage of Class Variables) Pythonic - or nasty habit learnt from java ?

Hello Pythoneers: the following code is only a mock up of what I'm trying to do, but it should illustrate my question. I would like to know if this is dirty trick I picked up from Java programming, or a valid and Pythonic way of doing things: basically I'm creating a load of instances, but I need to track 'static' data of all the instan...

How to Initialize a Instance of a PHP Class using another Object Instance?

What would be a good way (along with any pros and cons) of initializing an instance of a PHP class with another object of the same class (ideally in PHP 4.x)? Here in initialize() is essentially what I'd like to be able to do (example is extremely simplified from my use-case, see below): $product = new Product('Widget'); $product2 = ne...

Simple class concepts in C++ (cards in a deck)

Hey you guys were absolutely great with my last problem so hopefully you can help clarify something else to me. Classes confuse me! For this particular assignment, we are to do the classic 'Cards in a Deck' program. We are to make two classes, one called 'Card' and the other 'Deck'. Now I've gotten a large chunk of this done so far but...

Methods in classes in C#

Hi, I have a number of different clases located in a class library in my project. I am using Quartz.NET (a scheduling system) to schedule and load jobs, and the actual job execution is done in these class libraries. I plan to have many types of job types, and each one will have their own class for execution in the class library. An issu...

Binding property inside nested class in Silverlight

Is it possible to bind property of the nested class in Silverlight? I have code that looks like this: public class A { public class B { public String Prop1 { get; set; } } } I want to assign a key for class B in xaml but I don't know how to do it. I tried something like this, <controls:ChildWindow.Resources> <loc...

How to call a self.value in a class function definition in python?

How could I call a self.value in a definition of a function? class toto : def __init__(self): self.titi = "titi" def printiti(self,titi=self.titi): print(titi) ...

PHP make class propery inheritable

Hi, i have 2 classes A and B that extends A. A has a public property and i want that on the instances of B that property can't be accessible. I try to explain better: class A { public $prop; } class B extends A { ... } $instance=new B; $instance->prop; //This must throw an error like "Undefined property prop" I tried with the ...

C++, unmanaged, class, members: How (if at all) can I list all the members in a class?

Possible Duplicate: Iterate through struct variables. So I have a header file and a code file. The class is representation of a View that will be queried from stored proc. For each col. in view there is one data member in class. Currently in code we have something like this: Load( Reader reader) { m_col1 = reader("m_col1...

Netbeans wizard to generate php classes

Hello. I want a wizard where I insert the database connection, and with some settings it generates the PHP classes. The wizard can use (internally) a template already created. Is that posible? Does that already exists? If not, any ideas of how to do it? Thanks! Edit I'm looking for something wich let me make my own class template or...