Questions tagged [getter]
A getter is a public accessor method, used in object-oriented programming, which returns the value associated with a private member of a class.
getter
1,893
questions
0
votes
0
answers
19
views
sequelize getter in HasMany error TypeError: is not a function
I want to make a getter beetween two table. In the controler of one who get in the other, the getter is not a function.
The model Comitee who as many club
export class Comitee extends Model<...
1
vote
2
answers
96
views
How to write a getter which accesses a heap-allocated member variable
Lets say I have the member:
char* name;
When writing a getter function to this member, is this the correct way:
char* getName(){
return name;
}
But when we do this, now user of this class can ...
0
votes
0
answers
65
views
How to use Classes and their getters in Pinia store?
I have defined a Pinia store in which my user's character is made, stored/retrieved from localStorage, and pushed into an array which the store eventually returns.
This is done by defining the class ...
0
votes
3
answers
126
views
What is the difference between get and function in an Object (Javascript)?
I have hard time understanding why there are two different ways to perform an absolutely identical operation in JavaScript objects.
Here I've got an object which contains an array in its "log&...
0
votes
1
answer
94
views
Getters for multidimensional arrays
I was wondering how to exactly do a getter for a multidimensional array. I have a class (called Figure), one of its attributes is a bidimenisonal array (matrix), and I want to read that matrix from ...
0
votes
2
answers
180
views
Does FilamentPHP execute Models accessors when editing or viewing a row?
I have a critical concern, which might have a dumb & simple solution I cannot find, or it might open a Pandora box.
If you define an accessor in a model, and then you try to use it in a ...
0
votes
0
answers
31
views
javascript export variable or getter but returning value?
So I'm working with some export in js and do not understand the way they interact...
I have those two files :
imported file
export var a = 0;
// getter on a
export function A() {
return a;
}
// ...
-1
votes
3
answers
74
views
Getter returns undefined in if statement. Seems not working for comparisons
I have a ClockObj which has an AlarmObj in a "HAS A" OOP relationship. Or should I say injected through the constructor.
Inside the AlarmObj I have a isAlarmOn boolean variable. I am ...
0
votes
1
answer
44
views
why am I getting an error on calling clothing.getLastWornDate() method? [closed]
I am working on a Java assignment for school. In this method, I am trying to save to a file as described by assignment, but I am getting an error when calling clothing.getLastWornDate() and am lost as ...
0
votes
0
answers
55
views
Angular async pipe loading page forever when using getter in component
I have created standalone component.
import { AsyncPipe, CommonModule } from '@angular/common';
import { Component, OnInit } from '@angular/core';
import { FormsModule } from '@angular/forms';
@...
0
votes
1
answer
68
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 { ...
0
votes
2
answers
179
views
Get the default value of a property of an abstract class
Is there a way in C# to access the default value of a non-static, non-const property that is defined in an abstract class?
For example, given:
public abstract class SomeClass
{
public int ...
0
votes
1
answer
127
views
How to subclass Array in JavaScript and override 'length' getter and setter?
I am trying to subclass JavaScript array and override 'length' getter and setter. This code is not working - it outputs nothing to the console because getter and setter are not called. How to fix this?...
-2
votes
1
answer
61
views
getter method does wait for a previous async call to complete
I have this in my JS file :
let xe = 0;
const get_usd2inr = async () =>
{
return await fetch(BASE_URL + "api/usd")
.then(response => response.json())
.then(response =>
...
0
votes
1
answer
47
views
How to dynamically set a getter for an Objective-C object property?
FooClass has a property called foo.
It's declared as @property (nullable, nonatomic, readonly, strong) id foo and it has NO underlying storage, it's not synthesized. It's just a getter that by default ...