reference

How does an object reference itself in Javascript?

I was experimenting with inheritance in javascript, and wrote those two functions: Object.prototype.inherits=function(obj){this.prototype=new obj;} Object.prototype.pass=function(obj){obj.prototype=new this;} This code works very well: Dog.inherits(Animal); But the following fails: Animal.pass(Dog); As I understand it, my pass f...

F# closure: Map reference cell is always empty.

Given the following code: static member private getIntValue (_map:Map<string, int>) (_key:string) = if (_map.ContainsKey _key) then _map.[_key], _map else let i = doSomething () i, if i > 0 then _map.Add (_key, i) else _map static member private getDataFn<'T> (_getFn:Map<string, 'T> -> string -> 'T * Map...

How big is an object reference in .Net

Apologies if this has been asked before - searching SO for the terms "object reference" primarily returns page after page of questions about NullReferenceException. What is the size of an object reference in .Net? Does it vary between x86, x64, and/or AnyCPU compilation? If it makes a difference, I'm personally interested in C#. ...

How much memory does null pointer use?

In C# if i use the following code Dictionary<int,object> dictionary = new Dictionary<int, object>(); dictionary.Add(1,null); dictionary.Add(2,new object()); dictionary[2] = null; How much memory is being allocated? does each object reference in the dictionary (dictionary[1], dictionary[2]) takes a pointer size (32 or 64 bit) on the he...

constant references with typedef and templates in c++

I heard the temporary objects can only be assigned to constant references. But this code gives error #include <iostream.h> template<class t> t const& check(){ return t(); //return a temporary object } int main(int argc, char** argv){ const int &resCheck = check<int>(); /* fine */ typedef int& ref; const ref error = check<int...

Question about const_cast in c++

Hi,all: this is quoted from Effective C++ 3rd editiion const_cast is typically used to cast away the constness of objects. It is the only C++-style cast that can do this. My question is can const_cast add constness to a non-const object? Actually i wrote a small programme trying to approve my thought. class ConstTest { public:...

Can java properties file reference other properties file?

Can java properties file reference other properties file? ...

How to check C source code against the current standard?

I'm continuing to learn C and would like to adhere to whatever is the current standard, but finding a good reference to that seems to be problem. From what I've found online (mostly through Google and Wikipedia) is that the current standard used today is C99, more formally the ISO/IEC 9899:1999 standard. When I'm writing C code, I ofte...

Where can I find a good reference for the ELF file format?

I'm in the process of writing a compiler that will be generating ELF executable files for the i386 platform. However, I need a good reference for the file format (information on headers, relocations, etc.). Is there such a reference? ...

Cross Reference and Passing the This Pointer between Classes [NS2/C++]

------------ ------------ | TclObjct | | Handler | ------------ ------------ |__________________________________| | -------------- ...

How to reference R.java of other apps in Android, like com.android.music?

I am trying to develop an app to supplement the built-in music player. I've used git to download the com.android.music package and looked around at its code. I can launch the music player by copying some of its code and launching activities with intents. Now what I need to do is get a handle to its current view. In the MusicUtils.jav...

are reference and pointer equal with regards to polymorphism

I always think of having to use pointers for polymorphism. Using the canonical example: DrawEngine:render(Shape *shape) { shape->draw(); shape->visible(true); } And passing in pointer to various Shape derived classes. Does it work the same with references DrawEngine:render(Shape &shape) { shape.draw(); shape.visible...

Binary trees in C++ using references

I wish to implement a binary tree using references instead of using pointers (which is generally what you tend to find in every book and every website on the internet). I tried the following code: class tree_node { private: tree_node& left; tree_node& right; data_type data; public: void set_left(tree_node&); // ... o...

SFML Input system problem

So I was porting my game engine from SDL to SFML, and now I have a problem with my input system. Input.h #ifndef BULLWHIP_INPUT_H #define BULLWHIP_INPUT_H #include class bc_Input { public: bool bm_KeyHit(sf::Key::Code key); bool bm_KeyDown(sf::Key::Code key); int bm_MouseX(); int bm_MouseY(); ...

Problem reference a com assembly dll

I have a problem. When I import a COM dll (VB6) in my C# application, All is fine. It compiles and works. However when I use the app on an other PC, I have an error message : Unable to cast an object to COM type Installation.VB6FenetreClass Installation._VB6Fenetre interface type. This operation failed because the QueryInterface cal...

Doubt on a C++ interview question

I have read Answers to C++ interview questions among which there is one that puzzles me: Q: When are temporary variables created by C++ compiler? A: Provided that function parameter is a "const reference", compiler generates temporary variable in following 2 ways. a) The actual argument is the correct type, but it isn't Lv...

Evaluation of a reference expression

As per @Potatoswatter's suggestion, I have created a new discussion. Reference is this response from @Potatoswatter Given the code snippet, int i = 3, &j = i; j = ++ i; The comment which I seek clarity on, is this. (which seems to be an important missing piece in my understanding of the unsequenced evaluation a.k.a sequence point)...

References classes?

what's the correct way to reference a class, in this case from the same package. the code below shows class "Two" attempting to trace the value of a variable in class "One". no success. trace returns undefined. //Class One package { import flash.display.Sprite; public class One extends Sprite { public var myString:String =...

Passing an object to a function taking pointer as parameter

How does it work when I only have an object but my function takes a pointer to that type of object. Someoclass test1; SomeFunction( Someclass*) { //does something }; ...

JavaScript Pass Variables Through Reference

Hello! Is there an equivalent in JavaScript for PHP's reference passing of variables? [PHP]: function addToEnd( } $myVar="Hello"; addToEnd($myVar," World!"); print $myVar;//Outputs: Hello World! How would the same code look in JavaScript if possible? Thank you! ...