Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Coffee corner » c++ standard read-only property flag would be handy
Re: c++ standard read-only property flag would be handy [message #49067 is a reply to message #49066] Wed, 13 December 2017 09:21 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14261
Registered: November 2005
Ultimate Member
luoganda wrote on Tue, 12 December 2017 11:59
for c/c++ language usually set/get are needed for properties,
using public_read section or flag would be useful for
properties, so there are not unneded code, eg:
class Class{
  public:
  //accessed and modifiable by any
  int someProp;
  
  //this would be non-modifiable in outer usage
  public_read:
  int somePropX;

  //or
  int public_read somePropX;
  //or
  public_read int somePropX;
  //or something...
};


for compilers that would not implement this,
just "unsafe" public: would be used instead.


IDK, people are having these various ideas about properties, but I do not understand why. Is it really so hard to write () ?

Also, with (writable) properties, one can do things like

a.ink = White;
a.font = Arial;


which IMO is really verbose and inconvenient compared to "U++ chained modifiers" style

a.Ink(White()).SetFont(Arial());
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: OCR library (Tesseract?)
Next Topic: some good audio library?
Goto Forum:
  


Current Time: Fri Jun 06 10:06:23 CEST 2025

Total time taken to generate the page: 0.04601 seconds