Skip to main content

Questions tagged [reference]

A reference is a value that enables a program to indirectly access a particular datum.

Filter by
Sorted by
Tagged with
0 votes
2 answers
350 views

I'm new to coding and am currently trying to learn C++ myself. I just learned about function parameters and pass by value vs pass by reference. Everywhere I read, they say that one of the reasons pass ...
Karanveer A's user avatar
-2 votes
1 answer
376 views

I am working on a simple interface to SharePoint via Graph API. I have created a project that references Azure.Core, Azure.Identity, Microsoft.Graph, and other dependencies required to make calls via ...
Sigmundur's user avatar
  • 105
4 votes
2 answers
2k views

When I started programming, I learned what Pointers are in C++. In Java, references are variables which hold the address of an object. So conceptually it's a pointer, without the ability to directly ...
tweekz's user avatar
  • 237
11 votes
3 answers
3k views

I'm writing in C++, but this problem applies to any language without GC and even to languages with a GC as well. I have a structure in memory in which I create/add objects. The structure takes ...
Helloer's user avatar
  • 293
5 votes
4 answers
2k views

What are the relationships between these pairs of concepts: value/reference type; value/reference object; value/reference semantics? For the first pair of concepts, it seems to me that an object of ...
Géry Ogam's user avatar
3 votes
1 answer
3k views

I'm trying to design an API for an object manager that registers and retrieves different related objects. When I want to retrieve an object, I can query it by its object id. I'm wondering if I should ...
Marvg's user avatar
  • 33
0 votes
2 answers
402 views

I use "reference" term here like in C++ world, not like in C# (for example). I use non-C++ syntax on purpose -- this is general question, not about this particular implementation. Starting something ...
greenoldman's user avatar
  • 1,533
1 vote
1 answer
3k views

I am bit puzzled as for why this does not throw an exception - I believe the CLR does not delete the object because there is a reference to it? static void Main(string[] args) { ...
John V's user avatar
  • 4,946
9 votes
2 answers
6k views

Using C++ I'd like to do something along the lines of: Try to get a reference to something in, say, a map If it throws, then return straight away Otherwise, go and use the reference However because we ...
Alex's user avatar
  • 193
1 vote
2 answers
1k views

I am trying to understand the ideas of pointers and references in C++. I am stuck with the following, what would be the specific behaviour in this case? I have a class like this: class MyClass{ ...
Vlad's user avatar
  • 137
1 vote
3 answers
647 views

In Java: private State current_state; As "State" is a superclass, I can then assign subclass objects to current_state, effectively making current_state point to a different object: current_state = ...
M-R's user avatar
  • 237
-1 votes
1 answer
375 views

If Strings are immutable in Java, why is the output of this code 2GB, instead of 1GB? class Laptop { String memory = "1GB"; } class Workshop { public static void main(String args[]) { ...
Nemus's user avatar
  • 109
6 votes
2 answers
7k views

Assuming I have this class (Java code only for the sake of example): class Person { private String name; public void setName(String name) { this.name = name; } } When I write ...
Martin Andersson's user avatar
10 votes
3 answers
7k views

Assuming we have two classes: class A { ... } class B : public A { ... } Would it be better to write std::deque<shared_ptr<A> > container; or std::deque<reference_wrapper<...
user avatar
3 votes
3 answers
10k views

I'm new to C++, coming from Java. In Java, all variables (except for primitives) are essentially pointers. They hold the address of whatever they're 'holding'. So any Java data structure stores it's ...
Aviv Cohn's user avatar
  • 21.6k
4 votes
3 answers
1k views

For every a and b which are non-const pointers of the same type, you can do a = b;, right? Inside non-const member functions the this keyword exists, which is a non-const pointer. So logicaly if b is ...
user3123061's user avatar
  • 1,597
2 votes
1 answer
113 views

PHP 5.5 I'm doing a bunch of passing around of objects with the assumption that they will all maintain their identities - that any changes made to their states from inside other objects' methods will ...
Buttle Butkus's user avatar
0 votes
1 answer
413 views

I need to reference the latest version of Bouncy Castle in a project I intend to publish to Github. In my first posting of the code to Github, someone complained that I downloaded the entire Bouncy ...
makerofthings7's user avatar
-1 votes
2 answers
985 views

In Java and other high-level languages, a reference leads to an object. In C++, as far as I know, a pointer can also lead to an object. So what's the difference between a reference leading to an ...
user3150201's user avatar
  • 1,207
3 votes
3 answers
8k views

Reference to a literal is possible only if the reference is declared as constant. But why is a pointer to a const object not possible in case of literals? i.e. int const& ref = 5;// But why is ...
sk patra's user avatar
  • 457
7 votes
3 answers
4k views

I haven't been able to find the appropriate terminology to search for content on the web related to what I'm asking, so I'm hoping someone on here can at least point me in the right direction. I'm a ...
Dan's user avatar
  • 207
7 votes
2 answers
14k views

I have multiple functions and a lot of code inside $(document).ready(function()). I am using jasmine to test the functions inside the ready function as well as the code inside ready() but when the ...
makmak's user avatar
  • 71
32 votes
7 answers
18k views

I have some C++ knowledge and know that pointers are commonly used there, but I've started to look at PHP open source code and I never see code using references in methods. Instead, the code always ...
Alexander Cogneau's user avatar
107 votes
4 answers
73k views

C has pointers and Java has what is called references. They have some things in common in the sense that they all point to something. I know that pointers in C store the addresses they point to. Do ...
Gnijuohz's user avatar
  • 2,075
7 votes
2 answers
3k views

In relational world we have Foreign Keys to reference other entities. But how do document-oriented databases like MongoDb, CouchDb, RavenDb implement references among entities? Update. StackExchange ...
SiberianGuy's user avatar
  • 4,823