There's a good discussion of Generics and what they really do behind the scenes over at http://stackoverflow.com/questions/31693/differences-in-generics so we all know that Vector < int[]> is a vector of integer arrays, and HashTable< String, Person> is a table of whose keys are strings and values Persons.
What stumps me is the usage ...
Hi Everyone,
I'm having some problems getting my object to gracefully fail out if an invalid parameter is given during instantiation. I have a feeling it's a small syntax thing somewhere that I simply need fresh eyes on. Any help is more than appreciated.
class bib {
protected $bibid;
public function __construct($new_bibid) {
...
Hi,
I'm getting a "Call to a member function process_data() on a non-object in page.class.php on line 35" even though the object has been called.
Here is the index.php extraction showing the object being instantised
// require our common files
require("modules/module.php");
require("registry/objects/datetime.class.php");
require("reg...
What makes a type different from class and vice versa?
(In the general language-agnostic sense)
...
What is the best way of taking a query and transforming it into a nested class list without doing a subselect for each row?
eg.
1 aaaa
1 bbbb
1 cccc
2 dddd
3 eeee
into
1
aaaa
bbbb
cccc
2
dddd
3
eeee
...
In your object-oriented language, what guidelines do you follow for grouping classes into a single file? Do you always give each class a seperate file? Do you put tightly coupled classes together? Have you ever specified a couple of implementations of an interface in one file? Do you do it based on how many lines of code the implementati...
I have found one error in my Java program:
The public type abc class must be defined in its own class
How can I resolve this error? I am using Eclipse. I am new to Java programming.
...
I'm in the process of learning Java and my first project is a calculator, however I've run into a snag. I'm trying to get my calculator to let me enter a number then click an operator (+, -, x, /), enter another number then hit an operator again and have the display update and be able to keep this going.
Example, I would like to be abl...
Hello! I'm fairly new to C# but I will try to make this quick! ;)
This is just a theoretical situation, but imagine that:
I) One have a class 'ClassA' with a 'ClassB' inside it and a 'ClassC' inside of 'ClassB'.
II) ClassA have a method which gets called. The method itself is (don't know the name for this) 'constructing' a new ClassB ...
I want to do this:
class MyClass {
var $array1 = array(3,4);
var $array2 = self::$array1;
}
and $array2 doesn't work.
Do you have a solution/trick to make a class property equal to another class property?
Thanks.
...
The problem is a need to take the arguments into account before choosing the responder. Here is my attempt so far.
from responders import A, B, C
class RandomResponder(object)
def init(self, *args, *kwargs):
self.args = args
self.kwargs = kwargs
def __getattr__(self, name):
# pick a responder based on t...
What is the advantage of local classes in Java or in any other language that makes use of this feature?
...
I currently posses a List of Objects(Using Java 1.3), and let's say that I wanted to cast one of the Objects returned from list.get(i) to a type of which I only know the name of the Class as a String. Essentially, how do I
Object o = (classname)list.get(i); where className is a String variable of a className.
I thought that I could use...
So here is the deal. I want to call a class and pass a value to it so it can be used inside that class in all the various functions ect. ect. How would I go about doing that?
Thanks,
Sam
...
I have learned how to use classes in PHP and so far I have only really found one useful application for them. I created a user class to preform various tasks relating to users in my web application such as output the avatar, show number of messages ect.
Aside from this example, what are some other useful ways to utilize classes in a pra...
Say I have the following:
tr {
background: #fff;
}
tr.even {
background: #eee
}
tr.highlight {
background: #fec;
}
Is it possible to specify a 4th background (#fea) instead of having highlight simply overwrite even?
<tr class="even highlight">
<!-- ... -->
</tr>
Once CSS3 is supported, nth-child might work. But, a...
In C++, I have a class A which is friend with a class B.
I looks like inherited classes of B are not friend of class A.
I this a limitation of C++ or my mistake ?
Here is an example. When compiling, I get an error on line "return new Memento":
Memento::Memento : impossible to access private member declared in Memento.
class Originat...
C++ newbie question. Please, verify I'm doing it right.
I have a global application class spawning it's little kids and I need to give the kids access to some of the application facilities. So I decided to pass them to children by reference.
I tested the idea as show below. It seems to work fine. I just wanted to make sure I'm not doin...
How does one go about and try to find all subclasses of a given class (or all implementors of a given interface) in Java?
As of now, I have a method to do this, but I find it quite inefficient (to say the least).
The method is:
Get a list of all class names that exist on the class path
Load each class and test to see if it is a subcla...
Why the following example prints "0" and what must change for it to print "1" as I expected ?
#include <iostream>
struct base {
virtual const int value() const {
return 0;
}
base() {
std::cout << value() << std::endl;
}
virtual ~base() {}
};
struct derived : public base {
virtual const int value() const {
...