class

Immutable classes in C++

Hi, In one of my projects, I have some classes that represent entities that cannot change once created, aka. immutable classes. Example : A class RSAKey that represent a RSA key which only has const methods. There is no point changing the existing instance: if you need another one, you just create one. My objects sometimes are heavy a...

How can I add a class to my flash cs4?

I am about to create a simple demo in flash where I have 3 layers, 3 keyframes. Currently I am just use some simple gotoAndStop() to move to the next keyframe. But now I need a custom event to do that but I can't create a class inside the action of a keyframe so I am not able to create a custom event. I just have AS3 developing experie...

Strange Java code: Class in a Class

In some sample codes there are methods and classes declared WITHIN other methods and/or classes. I've never heard/read about this. What effect does this kind of programming have? Wouldn't it be better to write down classes in a seperate file and methods side by side and not within each other (like every book tells you)? What are the adv...

Differences in variable declarations in C++

Class A { }; What is the difference between A a , A* a and A* a = new A(). ...

Slider value available between different cocoa classes

I am playing around with an iPhone app, and need to accomplish something that I am sure is very basic: I have a slider that is implemented in a Controller.m class. However, I need its value must be available in a different class, MainView.m class where I have defined an equation that depends on the value of the slider. How can I do i...

error C2440: 'initializing' : cannot convert from 'classname *' to 'classname'

I have a class defined called extBlock. I then make an instance of that class with this extBlock mainBlock = new extBlock(1, 1024); I get this error: error C2440: 'initializing' : cannot convert from 'extBlock *' to 'extBlock' Can anyone help me with why I am getting this error. I have seen examples online of declaring it like th...

Identifying that a variable is a new-style class in Python?

I'm using Python 2.x and I'm wondering if there's a way to tell if a variable is a new-style class? I know that if it's an old-style class that I can do the following to find out. import types class oldclass: pass def test(): o = oldclass() if type(o) is types.InstanceType: print 'Is old-style' else: print 'Is NOT old-...

Can a function return an object? Objective-C and NSMutableArray

I have an NSMutableArray. It's members eventually become members of an array instance in a class. I want to put the instantiantion of NSMutable into a function and to return an array object. If I can do this, I can make some of my code easier to read. Is this possible? Here is what I am trying to figure out. //Definition: function Obje...

How can I easily get a Scala case class's name?

Given: case class FirstCC { def name: String = ... // something that will give "FirstCC" } case class SecondCC extends FirstCC val one = FirstCC() val two = SecondCC() How can I get "FirstCC" from one.name and "SecondCC" from two.name? ...

Using pipes inside a class in C++

I'm trying to use this tutorial to make plots with Gnuplot in C++. However I will be using the pipe to Gnuplot from within a class, but then I run into some problems: I've got a header file where I declare all variables etc. I need to declare the pipe-variable here too, but how do I do that? I've tried doing it straight away, but it do...

OOP in PHP: Class-function from a variable?

Hello Is it possible to call functions from class like this: $class = new class; $function_name = "do_the_thing"; $req = $class->$function_name(); Something similar solution, this doesn't seem to work? Martti Laine ...

Does the Dalvik file format (*.dx) support more instructions than a Java .class file?

Is there anything the Dalvik VM supports (in terms of bytecode) which is not used currently because the .class files don't have it? As an example, if people would write their own Source-to-DX converter for their functional language XYZ, would they be able to implement e. g. full tail calls although the .class file does support tail call...

Is there any way to redeclare a class safely in PHP?

We all know the infamous "cannot redeclare class" error. Is there any method to overcome this and actually declare a new class with the same name, or is this impossible in PHP 5? ...

What all does a compiler add to an empty class declaration?

Suppose, I write class A { }; compiler should provide (as and when needed) a constructor a destructor a copy constructor = operator Is this all what the compiler provides? Are there any additions or deletions to this list? ...

Where To Put User-defined Classes in Rails

I'm trying to to use this class http://robbyonrails.com/articles/2005/05/11/parsing-a-rss-feed but am not sure where to place the file so that it functions like a helper. ...

How would i go about showing the closest paragraph element to a unique link with jQuery?

The title is a bit rusty, sorry about that. Now let me explain what i'm trying to do. I have a few listed items, like this: <li> <a id="toggle" class="0"><h4>ämne<small>2010-04-17 kl 12:54</small></h4></a> <p id="meddel" class="0">text</p> </li> <li class='odd'> <a id="toggle" class="1"><h4>test<small>2010-04-17 kl 15:01<...

jQuery - toggle the class of a parent element?

Hello, again. I have a few list elements, like this: <li class="item"> <a class="toggle"><h4>ämne<small>2010-04-17 kl 12:54 by <u>nike1</u></small></h4></a> <div class="meddel"> <span> <img style="max-width: 70%; min-height: 70%;" src="profile-images/nike1.jpg" alt="" /> <a href="account.php?usr=...

javascript. is it posible for one member of an object to access another member of that object without explicit reference to the object itself?

For example: var myObj={ myValue="hola", asMember=function(){ alert( this.myValue ); } }; myObj.asMember(); // will work fine var asGlobal=myObj.asMember; // global alias for that member function asGlobal(); // won't work in javascript (will work in AS3, but i need js now) So the question is, can I rewrite asMember so that i...

Should I Make These Vectors Classes or Structs in C#

I am creating a geometry library in C# and I will need the following immutable types: Vector2f (2 floats - 8 bytes) Vector2d (2 doubles - 16 bytes) Vector3f (3 floats - 12 bytes) Vector3d (3 doubles - 24 bytes) Vector4f (4 floats - 16 bytes) Vector4d (4 doubles - 32 bytes) I am trying to determine whether to make them structs or clas...

Pass in the object a java class is embedded in as a parameter.

I'm building an android application, which has a list view, and in the list view, a click listener, containing an onItemClick method. So I have something like this: public class myList extends ListActivity { @Override public void onCreate(Bundle savedInstanceState) { getListView().setOnItemClickListener(new OnItemClickListe...