CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2006
    Posts
    40

    Question how to create property which I can pass parameters?

    Hello,
    Is it possible to create property which I can pass parameters? would you please give me an example or solution? here is what I would like to do:

    __property double a = {read=getA("a"), write=setA("a")};
    __property double b= {read=getB("c"), write=setB("c")};

    double getA(char *a);
    void setA(double value, char *a);

    double getB(char *a);
    void setB(double value, char*a);

    Thank you!

  2. #2
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,675

    Re: how to create property which I can pass parameters?

    I already posted in your other thread over there in the VC++ section, where I stated that IMO something taking parameters is not a property, but rather a member function (with the exception of the .NET default property, AKA indexer).

    However, while researching a suitible link to post for you, it turned out that apparently .NET and C++/CLI do allow for non-default indexed properties. IIRC I once tried that in one of my programs and didn't get it to work (for whatever reason), and then gave up further pursuing that idea.

    See these links:
    How to: Use Indexed Properties
    How to: Use Multidimensional Properties
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured