1,776 questions
Advice
0
votes
2
replies
173
views
Getters and Setters in Python (Dataclasses)
I'm learning for my Introductory Programming Course in uni and I don't have an overview over the different cases when it comes to Setters and Getters and the slides are not quite helpful.
So for ...
1
vote
0
answers
33
views
In TypeScript, only setters are overridden in subclasses, making it impossible to inherit getters from the parent class [duplicate]
The sample code is simple, as follows:
class Node {
id?: string;
private _parent?: Node;
get parent(): Node | undefined {
return this._parent;
}
set parent(value: Node | ...
-3
votes
1
answer
83
views
Dynamically created Python properties not invoking getters and getters
My code dynamically generates properties and the classes to contain them. The code creates immutably-typed properties such that assignments to them are automatically converted to the correct type, ...
-3
votes
1
answer
110
views
re . springboot java annotations to invoke setter and update a field in array object instance
package com.tesco.Alpacas.transformation.jml.v1.model.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.tesco....
0
votes
0
answers
180
views
C# .NET 8 Reflection is failing to set property when application is published
The code shown below works in .NET 4.6.2, and it works in DEBUG mode for .NET 8.
The code however FAILS after this it is published as a single file and when I try to run it.
I'm using reflection to ...
0
votes
0
answers
73
views
What is the point of the void setRadius at the end of this code? [duplicate]
I just started my second Java course in college and this is my first time seeing this. What is the point of void setRadius at the end of the code. The code works if I remove it, I'm just not sure what ...
1
vote
1
answer
68
views
Adding custom set method of a property in Kotlin interfaces without referencing a backing field?
I try to implement a custom set method for a property in an interface. How does one do it without referencing a backing field?
interface EmailUser {
val email: String
var jina: String
val ...
-3
votes
2
answers
200
views
How to make C++ container class store pointer to a const, but get as a non-const?
I have the some code similar to the following. This is obviously a stripped-down version.
struct Foo {
int bar;
Foo() : bar(0) {}
};
class Container {
Foo* foo;
public:
...
0
votes
1
answer
97
views
Construct a copy of an object with nullable fields nulled if they haven't been changed since construction [closed]
I have Java classes with some nullable members, which get constructed from JSON objects with some optional keys. After construction, I will modify the objects, populating some previously-null members, ...
1
vote
1
answer
77
views
How to set some value to a parent control template property by clicking on button inside this template?
I want to implement some custom Search TextBox with a loop icon and placeholder. So I created a custom Control Template where there is TextBlock for the loop icon (I used some symbols from specific ...
0
votes
1
answer
63
views
In Observablehq, how do I set property value for class in one cell from another cell, in the same notebook?
I am new to .js classes and I my goal is to set a property value for a class I define in one cell, from within another cell, where both cells are in the same notebook. In the example below, assume ...
1
vote
1
answer
180
views
Add a buffer period to WooCommerce Bookable products only if there are existing bookings
I'm using WooCommerce Bookings and if I add a buffer to a product using the admin UI it adds the buffer even if there are no bookings for that product on that day. That restricts the hours someone can ...
0
votes
0
answers
64
views
C# WPF Setting padding on a grid in an more ergonomic way
I'm new to WPF and am a bit confused by the purposes of setters. For example, in a Grid, I would intuitively like to code this:
<Grid Padding="5,5,5,5">
...
But I can't. I ...
0
votes
1
answer
82
views
How does the Setter method work in Java in this example :
In the Setter Method "setName()",
int the first line,
name=this.name ; takes the value of the string "nidhi"
in the second line,
this.name=name;
what actually happens i can't ...
0
votes
1
answer
355
views
LWC setter is not getting called
LWC setter is not getting called.
<template>
{message}<br><br>1. getter value: {displayMessage}<br><br>2. setter value: {updatedMessage}
</template>
import { ...