Questions tagged [object-destruction]
34 questions
2
votes
8 answers
Deleting a class object in java
I have a class named Point as below:
public class Point {
public int x;
public int y;
public Point(int X, int Y){
x = X;
y = Y;
}
public double Distance(Point p){
return sqrt(((this.x - p.x) * (this.x -…

Soroush khoubyarian
- 273
- 1
- 4
- 15
1
vote
1 answer
how to get nested object value inside a function in javascript while object destructuring?
while practicing object destructuring ; I faced some problems.
I have a object like this:
const secondObject = {
value : 2,
credit: 23,
details: {
serialNumber : 4
}
}
Now I want to get 'serialNumber' value inside a…

Arijit Maiti
- 99
- 2
- 8
1
vote
1 answer
Types in destructured value of object in function-like parameter's function
So, we have some function:
const someVal = func(customObject => {console.log(customObject.data.users)});
We can rewrite this function with object-destruction syntax to make it more pretty and laconic for users value:
const someVal = func(({ data:…

Pyroarsonist
- 186
- 1
- 6
1
vote
0 answers
Object destruction in php websocket
I have my web socket server, which contain an array of users which contain imports objects.
I want to send updates to the user during some methods calls on the import object.
I figured that to do so I would need to pass a reference of the server and…

Anthony VISSIERE
- 11
- 3
1
vote
4 answers
C++: Callbacks and system timer events during destructor cascade
Assume an OO design where objects call each other, and after a while the called upon objects callback the initiating objects (calls and callbacks). During normal program termination, while destructors are called, is there some kind of promise that…

Jonathan Livni
- 101,334
- 104
- 266
- 359
1
vote
1 answer
Does Destruction of Arguments Occur Prior to Return?
OK I have this sequence of events:
I construct an r-value object
I pass an iterator to that r-value object into a function as a parameter
The function operates on this iterator
The function returns this iterator by value
I dereference the…

Jonathan Mee
- 37,899
- 23
- 129
- 288
1
vote
1 answer
C++ Cascading destructions of objects with static storage duration
this link says about cascading destructions of objects with static storage duration is popular undefined behaviour in C++. What is it exactly? I can't understand. It will be more good if it is explained with a simple C++ program that can demonstrate…

Destructor
- 14,123
- 11
- 61
- 126
1
vote
2 answers
RVO vs std::unique_ptr<> cleanup
This is a question about C++ specs on object destruction vs Return-Value-Optimization.
Can I expect RVO return the right value before std::unique_ptr<> cleanup?
Foo Bar()
{
std::unique_ptr ptr = new Foo();
return *ptr;
}

kfmfe04
- 14,936
- 14
- 74
- 140
1
vote
2 answers
Destructor calls on objects never constructed before
I have the following code.
class Wave {
int m_length;
data_type * m_data;
public:
Wave(){
blah...blah...blah
m_data = NULL;
m_length = 0;
cout << "Wave " << this << " created on " << m_data << " with m_length "…

OlegG
- 975
- 3
- 10
- 30
0
votes
0 answers
Electron object destroyed
when I close my electron app sometimes I get an error object destroyed blabla. I googled it and I don't really think it's a proper way to fix it... Someone advised to fix it like this
ipcMain.on('aMessage', async e => {
// do smth with a…

Eugene1111
- 27
- 2
- 7
0
votes
1 answer
How to get a data from an object inside of a function (JS)
let's say that I have a function that includes an object
const someFunc =props=> ({
styles:{
somedata: 'somedata:',
},
infoSectionValue: {
bold: true,
},
images:{
donut: props.donut_base64,
icon: 'some icon'
},
content: [1,2,3]
}
})`
now I want…

Mahmoud Hlal
- 46
- 2
0
votes
1 answer
How are objects from derived classes constructed in C++
Im not a C++ pro, i've done mostly Java and C#. A teacher said something that confused me today. I've tried to validate the info by doing some research, but i ended up even more confused.
Lets say i have class A and class B. Class A is the base…

Frédéric Bélanger
- 51
- 5
0
votes
0 answers
C++ object reference returned by another object lifetime/scope
I'm currently playing with an idea of recursive reader/unpacker of various "mountable" fileformats. It should for example allow to read zipped file stored in vmdk file stored in NTFS directory structure.
Currently I have only this header, where I…
0
votes
1 answer
browser-inconsistent unexpected "undefined" string when using object destruction
When I am trying out some object destruction syntax in some browser consoles, something unexpected happened.
Firstly I entered
action = {
type: "SET_APPS_UI_REVERT",
device: 23456,
managedApps: "12345"
}
and then
( { type,…

Michael Lee
- 467
- 5
- 14
0
votes
1 answer
es6 object destructuring, assign into new object
new to es6 here. is there any way to shorten this code with es6 features? i'm trying to destructure from an object and put those pulled properties into a new object.
const { Height, Width, Location, MapAttachmentTypes,
ZoomLevelAdjustment,…

devdropper87
- 4,025
- 11
- 44
- 70