www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - diff between properties without or with property ?

reply "D-ratiseur" <ThisAdressDoesntExist nowhere.fr> writes:
Hello, what's the difference between a property declared  without 
a  property block and another one with? It seems that both forms 
are possible:

---
void Prop1(int AValue);
int Prop1();

or

 property
{
     void Prop1(int AValue);
     int Prop1();
}
---

Does it has something to do with the RTTI/serialization such as 
the "published" keyword in Pascal ? I cant find any clue in the 
manual.
Mar 04 2013
parent "Dicebot" <m.strashun gmail.com> writes:
On Monday, 4 March 2013 at 16:35:01 UTC, D-ratiseur wrote:
 Hello, what's the difference between a property declared  
 without a  property block and another one with? It seems that 
 both forms are possible:

 ---
 void Prop1(int AValue);
 int Prop1();

 or

  property
 {
     void Prop1(int AValue);
     int Prop1();
 }
 ---

 Does it has something to do with the RTTI/serialization such as 
 the "published" keyword in Pascal ? I cant find any clue in the 
 manual.

Difference appears when "-property" compiler switch is used, only second sample can be used with property syntax then. But this most likely change as there have been very intensive discussions on topic of property re-design recently.
Mar 04 2013