create my own property which passes parameters
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: create my own property which passes parameters

  1. #1
    Join Date
    Jun 2006
    Posts
    40

    Question create my own property which passes 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
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,009

    Re: create my own property which passes parameters

    __property keyword does not belong to the standard native C++.
    It is something from the managed C++ world, so please ask it in some of the .NET or managed C++/CLI forum
    Victor Nijegorodov

  3. #3
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,877

    Re: create my own property which passes parameters

    Quote Originally Posted by jwspring View Post
    __property double a = {read=getA("a"), write=setA("a")};
    __property double b= {read=getB("c"), write=setB("c")};
    Actually I do not match this syntax to any I'm aware of. It's definitely not managed C++ __property. Neither it's plain VC++ __declspec(property) extension. So I wonder whether it's C++ at all.
    Best regards,
    Igor

  4. #4
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,571

    Re: create my own property which passes parameters

    Generally speaking, (IMO) if it takes parameters, it's not a property, rather a member function. (Some sort of exception to this is the default property, AKA indexer, in .NET, but that would definitely be off-topic here.)
    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.

Tags for this Thread

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center