I suggest you ...

Refactoring C++: automatically generate getter and setter functions

This suggestion is migrated to Developer Community. Please use below link to view the current status.

82 votes
Sign in
Sign in with: facebook google
Signed in as (Sign out)
You have left! (?) (thinking…)
Anonymous shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →


Sign in
Sign in with: facebook google
Signed in as (Sign out)
  • JanW commented  ·   ·  Flag as inappropriate

    @AJ Although getters and setters are overused, I think that it would be good if your IDE could generate them.
    They are needed sometimes especially when you have just getter and no setter to make a field of an object read-only for those who only have access to public members and let those with access to private members modify the field.
    When you want to write a non-trivial setter (for example a setter with some code validating the input) the IDE would generate a simple setter and the programmers job would be to just modify the body of the function instead of typing full definition and optionally a declaration of such a setter.
    These are examples of situations where I believe implementing a setter or a getter is a good idea. I think situations like that occur frequently enough to make it worth creating a function in IDE that automaticaly generates getters and setters.

  • AJ commented  ·   ·  Flag as inappropriate

    @Edwig: Maybe those people should reconsider using getter and setters al over the place instead of asking the IDE to support them in what is imho a very questionable practice.

  • Edwig Huisman commented  ·   ·  Flag as inappropriate

    This would seriously reduce the amount of typing work in C++ as in comparison to C#!
    I'm not lazy, but it is one of the repeatedly heared complaints of C# programmers, if they have to do work in C++.

Feedback and Knowledge Base