Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why has the C++ Standard not added "properties" a la C#?

By properties I mean the C# style properties, with getters and setters.

I am interested to know why they are not a part of the C++ language. I am assuming such a feature must have been discussed while the specification was being written, and so it is a conscientious decision not to include it in the language.

like image 996
Matt Avatar asked Mar 20 '12 21:03

Matt


People also ask

What are the standards of C?

C11 is the current and latest standard of the C programming language and, as the name suggests, this standard was adopted in 2011. The formal document describing the C11 standard is called ISO/IEC 9899:2011.

What happened if standard library is not present in C?

Without the standard library, you're entire reliant on your own code, any non-standard libraries that might be available to you, and any operating system system calls that you might be able to interface to (which might be considered non-standard library calls).

What is the latest standard of C?

The latest C standard is ISO/IEC 9899:2018, also known as C17 as the final draft was published in 2018.


1 Answers

here is one implementation: http://www.codeguru.com/cpp/cpp/cpp_mfc/article.php/c4031/Implementing-a-Property-in-C.htm

int i = 5,j;
PropTest test;
test.Count = i;    //-- call the set method --
j= test.Count;     //-- call the get method --
like image 109
kirill_igum Avatar answered Sep 28 '22 21:09

kirill_igum