I have a homework assignment. I'm not looking for anyone to do the work for me, I'm just having trouble with one little aspect, although I'd accept advice on other bits as well.
The assignment is:
Write a class using a two-dimensional dynamic array.
The constructor passes in the dimensions of the array. The constructor also int...
I have a pretty general question about Haskell's type system. I'm trying to become familiar with it, and I have the following function:
getN :: Num a => a
getN = 5.0 :: Double
When I run this, I get the following error:
Couldn't match expected type `a' against inferred type `Double'
`a' is a rigid type variable bound by
the t...
I am learning the ropes in Python. When I try to print an object of class Foobar using the print() function, I get an output like this:
<__main__.Foobar instance at 0x7ff2a18c>
Is there a way I can set the printing behaviour (or the string representation) of a class and its objects? For instance, when I call print() on a class object,...
What's the best way to manage my custom classes without copying and pasting the folder they are contained in into the folder local to my project?
Example, I'm using the Tweener class and I have to copy and past the whole caurina folder into the folder of every project I'm working on. How do I designate one area for all of my custom clas...
I have a class which I need to use to extend different classes (up to hundreds) depending on criteria. Is there a way in PHP to extend a class by a dynamic class name?
I assume it would require a method to specify extension with instantiation.
Ideas?
...
I have the following code sample to illustrate my point. When I load this in IE8 on Vista I get the error "Stack Overfow at line:16"
If I recurse using a top level function (outside of the testClass object) I can recurse millions of times without a stack overflow.
Why is this happening? Ultimately I just implemented a Function Que ins...
Situation:
I have a class MyClass and its "lightweight" version MyClassLite, so i have
public class MyClass : MyClassLite
I also use hbm file for mapping my classes (they are mapped to the same table).
The thing is that when i try to get a list of MyClassLite entities, i get not only MyClassLite entities, but a list of MyClass entitie...
Hi there,
for past two hours i've been trying to pass responseText to the object i'm calling Ajax.Request in. And it just isn't happening :) Here's the code;
var traziSuggest = Class.create({
initialize:function( elemenat, sugDiv )
{
this.elemenat = $( elemenat );
this.elemenat.onkeyup = this.uzmiSug.bindAsEventList...
Hi,
is there any possibility to "invoke" a class instance by a string representation?
In this case i would expect code to look like this:
class MyClass {
public $attribute;
}
$obj = getInstanceOf( "MyClass"); //$obj is now an instance of MyClass
$obj->attribute = "Hello World";
I think this must be possible, as PHP's SoapClient a...
My new project has a design in which there are number windows services for performing different tasks. I have been given a task to create base class from which all of the windows service will inherit. This base class will perform common functions like creating instances of other windows services by iterating through the config file (may ...
Hi,
how I can access controls of Form class from another simple class
Lets say
I have create new clr (c++ .net 2008) windows application, & add a lable1 on it, (Form1.cpp & Form1.h created by default having namaspace tmp_beginInvoke_c)
then I create a new b.h file & add a simple reference class b. like code below,
#include "Form...
For private class variables, which one is preferred?
If you have a property like int limit, you want it to be:
int Limit {get; set;}
and use it inside the class, like so:
this.Limit
Is there a reason to use it or not use it? Maybe for performance reasons?
I wonder if this is a good practice.
...
I know that jQuery isn't designed for working with a class-like model but I really could do with being able to extend a base class as that fits my needs perfectly.
I started by just doing the following:
jQuery.myBase = {
foo: 'bar',
bar: function() { ... }
}
jQuery.fn.myPlugin = function() {
$.extend( this, jQuery.myBase, {...
Hi,
I was thinking a scenario like that :
class Utopia => A Base Class which pass it's fields and methods to derived classes.
class Watashi => A derived class, derived from Utopia and inherits everything
class Baka => A derived Class, Inherits some fields from Utopia
There are some types above and Type Baka should inherit some speci...
I am trying to do a homework assignment where we insert a string into a string at a specified point using a linked stack, hence the struct and typedef. Anyway, when I try to access stringLength in the StringModifier class inside the InsertAfter method, I get a run time error and I cannot figure out what the problem is. I should be able t...
Hello!
I'm trying to have pointer to class methods, so I have something like:
class foo {
public:
static void bar() {
}
};
void (foo::*bar)() = &foo::bar;
That doesn't compile :( I get:
> error: cannot convert ‘void (*)()’ to
> ‘void (foo::*)()’ in
> initialization
...
I'm not talking about inheritance. And I'm not talking about nested objects. I'm talking:
System::Web::Templating(...)
kind of nesting. These are classes of which you shouldn't create instances.. so...
...
I have a JavaScript class, and I would like to make it so it can't be subclassed. (Similar to marking a class with the "final" keyword in Java.) Here's my JavaScript class:
function Car(make, model) {
this.getMake = function( ) { return make; }
this.getModel = function( ) { return model; }
}
...
Is there a way in Python to add to the locals name-space by calling a function without explicitly assigning variables locally?
Something like the following for example (which of course doesn't work, because locals() return a copy of the local name-space) where the print statement would print '1'.
def A():
B(locals())
print x
def B...
Hi
I have a question to find a complexity class estimate of a algorithm. The question gives recorded times for an algorithm. So, do I just average out the times based on how it was computed?
Sorry, I missed a part.
ok, so it recorded time like N = 100, Algorithm = 300, next N = 200, Algorithm = 604, next N = 400 Algorithm = 1196, next...