Questions tagged [class-properties]

A class property, in some object-oriented programming languages, is a particular type of property that applies to a class rather than an instance of the class.

Class Property, in some object-oriented programming languages, is a special sort of class member, intermediate between a field (or data member) and a method.

Properties are read and written like fields, but property reads and writes are (usually) translated to get and set method calls.

See: - Properties (tag)

49 questions
1
vote
1 answer

BabelLoaderError: SyntaxError: Missing class properties transform

Getting the following message when I try to run my dev-server: BabelLoaderError: SyntaxError: Missing class properties transform. I've installed the class-properties babel plugin as you can see, and I have incorporated it into my .babelrc…
Paulos3000
  • 3,355
  • 10
  • 35
  • 68
1
vote
1 answer

Swift: Private Constants vs Constant Type Properties

Should I use a constant type property instead of a private constant? At the top of my ChatViewController.swift file, outside of the class definition, I have a private constant: private let messageFontSize: CGFloat = 17 But since this constant is…
ma11hew28
  • 121,420
  • 116
  • 450
  • 651
0
votes
0 answers

vb.net iterate through properties of properties (in a nested class)

I am trying to iterate through properties of properties. Below is my sample class Public Class Doc Public Property DocName As String Public Property flds As Flds Public Sub New() flds = New Flds() End Sub End Class Public…
0
votes
3 answers

Accessing Matlab Class Properties (aka Constants)

I have some classes that I created a couple of constant properties for. Here is some example code: classdef genericClassName < handle properties (Constant) Name = 'genericClassName' Description = 'description of the class' …
Jim
  • 5,940
  • 9
  • 44
  • 91
0
votes
3 answers

Is there any way I can shorten properties with similar statements but different returns?

class.... @property def degrees(self): hem, degs, mins, secs = self._correction() return degs @property def minutes(self): hem, degs, mins, secs = self._correction() return mins @property …
yuukiroh
  • 67
  • 2
  • 5
0
votes
2 answers

Runtime error when trying to add item to list property in a class in C#

I have a class with a property that is a List of enum values to be filled in runtime (I'm using a List instead of an array because I don't know beforehand how many items there will be). I declared the property like this: public class Entity { …
0
votes
1 answer

Accessing all class property values dynamically

So basically what I'm trying to do is list all properties of an object in a tableview in a key = value format. But I want this to be independent of future changes to the object, so that if a new property is added later, no changes will be needed to…
0
votes
1 answer

How to sort properties of object and populate into an ArrayList

How can I sort the following properties in the class then store in an ArrayList? I have populated that to an ArrayList but there an issue when page is reloaded items order in the repeater will change. here is population cookies value in to an array…
0
votes
1 answer

Call a function from a static property in PHP

I'm trying to directly call a function from a static property inside a class. Here is an extract of my class: class Uuid { const VERSION_3 = 3; const VERSION_5 = 5; protected static $hash_function = [ self::VERSION_3 => 'md5', …
CJ Dennis
  • 4,226
  • 2
  • 40
  • 69
0
votes
2 answers

How to auto populate a property within a List property of a Class

Firstly, thanks in advance for anyone who can help. I have a header and lines scenario. I want the lines object to auto-populate with the headerId from the Header. Please can someone help? public class Header { public int headerId { get; set;…
dev123
  • 25
  • 1
  • 9
0
votes
2 answers

How generate model class by json(Dictionary) or add properties to existing model class with no property

I spent so much time in writing meaningless code to generate model classes. For example: here is json data { "id": 1, "productcode": "5012014032", "productname": "通用点数", "categoryid": null, "supplierid": null, "inprice": null, …
J.Ren
  • 76
  • 6
0
votes
1 answer

Can a class property be initialized to an array of closures?

I am trying to store some validation functions inside a static configuration array. Storing functions in array seems to work, however, when I put the same code inside a class, it fails. Anyone know what's going on? $functions = array( …
0
votes
1 answer

Calling Class property using variables in Zend

I am creating partials where an items property names are passed from an array to access the values of those properties but I receive an error saying Undefined property of Namespace\Entity::$variable when defining $property->{$variable}. How would I…
0
votes
1 answer

angular2 share class properties

I have app component(for nav header) and auth component(for login). They need both "isLoggedIn" property which can be useful for app to change its "login" button to "logout" and for auth to block login attempt after login. But I don't know whether I…
Gompro
  • 2,247
  • 1
  • 16
  • 26
0
votes
1 answer

Can You Add a Class to a Class Property VBA

So I have two Class modules, ClassA and ClassB, and a sub in a module in which I try to add an object from Class B to a property of an object in ClassA. According to the VBE Glossary, classes are objects and the property set statement can add object…