![]() |
| | #1 |
| The Right Honourable Join Date: Mar 2004 Location: Where circles begin.
Posts: 1,068
| C++/CLI Property Code: public: String ^name; int ilImageName; int id; TEX_TYPE type; TEX_FORMAT format; Code: protected:
String ^name;
int ilImageName;
int id;
TEX_TYPE type;
TEX_FORMAT format;
public:
property String ^Name{
String ^get() { return(name); }
void set(String ^value) { name = value; }
}
property int ID{
int get() { return(id); }
void set(int value) { id = value; }
}
property TEX_TYPE Type{
TEX_TYPE get() { return(type); }
void set(TEX_TYPE value) { type = value; }
}
property TEX_FORMAT Format{
TEX_FORMAT get() { return(format); }
void set(TEX_FORMAT value) { format = value; }
}
Thanks.
__________________ Memorial University of Newfoundland Computer Science Mac and OpenGL evangelist. |
| psychopath is offline | |
| | #2 |
| The Right Honourable Join Date: Mar 2004 Location: Where circles begin.
Posts: 1,068
| Sorry about putting this in the wrong forum first. I wasn't sure whether to put it here in the Windows forum, or in the C++ forum. At least i'll know for next time.
__________________ Memorial University of Newfoundland Computer Science Mac and OpenGL evangelist. |
| psychopath is offline | |
| | #3 |
| Super Moderator Join Date: Aug 2001
Posts: 7,812
| I think all of us are trying to figure out just where to put CLI. I know where I'd like to 'put' it.
__________________ If you aim at everything you will hit something but you won't know what it is. |
| Bubba is offline | |
| | #4 |
| Registered User Join Date: Jun 2006
Posts: 30
| The good thing about properties is that you can do additional processing of values that users store or retrieve. For example, say you have a property called Age. If you would make Age a public member, then any value could be stored there, which might lead to errors. You don't want people to store negative values there or numbers like 1560. So your Set() function might look something like this: Code: void Set(String^ value) {
if (value < 0 || value > 120)
value = 0;
age = value;
}
|
| Newbeee is offline | |
| | #5 |
| The Right Honourable Join Date: Mar 2004 Location: Where circles begin.
Posts: 1,068
| So it's basically like writing a custom handler for variable assigment? If so, then in my particular case, shown in my first post, using properties would probably be overkill, since I have no need of additional processing.
__________________ Memorial University of Newfoundland Computer Science Mac and OpenGL evangelist. |
| psychopath is offline | |
| | #6 |
| Registered User Join Date: Jun 2006
Posts: 30
| That's correct. |
| Newbeee is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| static property | George2 | C# Programming | 1 | 06-12-2008 01:03 AM |
| Problem with a file parser. | Hulag | C++ Programming | 7 | 03-17-2005 09:54 AM |
| Creating a modeless property sheet | axr0284 | Windows Programming | 6 | 01-12-2005 06:29 AM |
| Dialog Box & Property Sheet :: MFC | kuphryn | Windows Programming | 2 | 08-01-2002 01:33 PM |
| Property Sheets :: MFC | kuphryn | Windows Programming | 0 | 05-09-2002 03:04 PM |