Questions tagged [object-reference]

An Object reference is a pointer to an object stored in memory. The main difference is that the object was previously created (via a new operator, for instance) and its reference is kept via an additional variable, that is, its object reference.

An Object reference is a pointer to an object stored in memory. The main difference is that the object was previously created (via a new operator, for instance) and its reference is kept via an additional variable, that is, its object reference.

More Info

325 questions
4
votes
3 answers

Is there a good way to perform WPF/C# object dereferencing, for garbage collection?

Application Background Our platform is a click-once WPF application. We have a "shell" that contains a navigation menu structure and it hosts our own custom "page" classes. When you navigate to a new page, we swap out the content of the shell…
Phobis
  • 7,524
  • 10
  • 47
  • 76
4
votes
1 answer

C# Destroy object and all references to it

Below C# code ResBlock resBlock1 = new ResBlock(); resBlock1.CustomerID = "ABC"; Block block = new Block(); block.Tag = resBlock1; resBlock1 = null; Console.WriteLine(((ResBlock)block.Tag).CustomerID); The output would be "ABC".…
Nik Dell
  • 53
  • 7
4
votes
2 answers

How do I copy Javascript Error without reference?

I want to copy Javascript Error without reference. Example: const error1 = new Error('error1'); const error2 = error1; error2.message = 'error2'; console.log(error1); console.log(error2); Output: Error: error2 at evalmachine.:1:16 …
Laode Muhammad Al Fatih
  • 3,994
  • 1
  • 18
  • 32
4
votes
3 answers

Object reference null- URL rewriting asp.net

I have developed my asp.net website in .NET 2.0 in other system where it is working fine. Now when I copied the asp.net website in my system and run it than I am getting the run time error: Object reference not set to an instance of an object. …
Chris
  • 2,293
  • 11
  • 48
  • 86
4
votes
4 answers

Linkedlist implementation in Java doesnot seem like linkedlist as in C++

I was going through the LinkedList and seen the implementation in Java. Back in days when I tried and implemented the linkedlist, it was with pointers and addresses and a lot of hard work. With Java the implementation is easier but still took some…
nobalG
  • 4,544
  • 3
  • 34
  • 72
4
votes
1 answer

Python multiprocessing object reference

I don't get python multiprocessing module. I start a process with the function and pass and object as its parameter. As I understand it, it should be the exact copy of that object. But if I try to print the address of that object it is the same in…
4
votes
3 answers

c# object pass by reference or pass by value

The output of the following code surprised me. I think "a" should hold a reference to the newly created object. Can someone explain why the result is not 2? class Program { static void Main(string[] args) { aclass a = new aclass(); …
mortdale
  • 382
  • 4
  • 16
4
votes
3 answers

C++ Creating Global Reference of an Object

I am trying to create a global reference of an object but it seems fails or I am getting another error in Qt C++. I have a class called 'System' which holds many objects as members. I want to access System's members from everywhere include members…
4
votes
3 answers

Java Interfaces and Memory Allocation

Consider: public SomeClass implements SomeInterface{...} SomeClass obj = new SomeClass(); SomeInterface x = obj; I am trying to relate line 3 to my very basic understanding of memory management. I know the memory location represented by "obj"…
3
votes
1 answer

Python swap leads to unexpected results when order changes

Python supports 1-line A/B swap (A , B = B , A), and we would expect (B, A = A, B) would lead to the same result. However, I met a strange behavior when dealing with a list entry. I simplify my finding in the code below: nums = [0, 0, 0, 0] n =…
3
votes
5 answers

C# garbage collection with object references

In C#, when I have two object obj1, obj2 composed of a List and I assign both of those objects to the same List object. If my reference to obj1 goes out of scope but my reference to obj2 does not, is obj1 still eligible for garbage…
user623879
  • 4,066
  • 9
  • 38
  • 53
3
votes
4 answers

Object Relationship Design

I just happen to ponder of a OO concept which may sound quite trivial but I don't know why I find it quite confusing. Anyway, I am thinking for example, if I have an Animal class and a Location class. And I only allow one animal to be at one…
Carven
  • 14,988
  • 29
  • 118
  • 161
3
votes
3 answers

Common case for comparing two objects references

Beside checking if null (something == null) when do we use object reference comparisons in Java? I can't think of any case to use object reference comparisons. For me that seems a little weird for a language abstracting all memory allocations.
ForguesR
  • 3,558
  • 1
  • 17
  • 39
3
votes
3 answers

.NET Binary Serialize object with references to other objects . . . what happens?

If you have an object instance A that references other objects (for example instances B and C), and you binary serialize A to a file, what happens? Do you now have serialized data that includes A, B and C? How does it work exactly? What will I get…
richard
  • 12,263
  • 23
  • 95
  • 151
3
votes
1 answer

Java, what is happening internally when you do object = object?

I am implementing singly linked list in Java, and I have a problem. In addition and removal of nodes, many people use temporary node like this: public Object removeFirst() { Node temp = head; head = temp.next; Object returnData =…
1
2
3
21 22