thomus07
October 25th, 2008, 12:47 AM
Dear brother,
Hope you all are well :)
I have been working in C++ and C#. It is a known fact that, member data should not be public or protected inside a class, since it's against OOP.
Now a days, I happen to see in many projects having member data as public. Even big projects designed by arguably experts have this.
Recently I have seen a code in C#, having a class with no member functions at all but all member data public. They have implemented this something like structures in C. I argued them to use properties available in C#, but they said, public data inside a class module is really not that evil, but only lazy to implement it.
I happen to see this more in C# than C++.
As for me, not an expert in C++.
What I follow is, I will use methods with respect to C++ and properties with C#.
Will this kind of design really has potential flaw ?
:)
Hope you all are well :)
I have been working in C++ and C#. It is a known fact that, member data should not be public or protected inside a class, since it's against OOP.
Now a days, I happen to see in many projects having member data as public. Even big projects designed by arguably experts have this.
Recently I have seen a code in C#, having a class with no member functions at all but all member data public. They have implemented this something like structures in C. I argued them to use properties available in C#, but they said, public data inside a class module is really not that evil, but only lazy to implement it.
I happen to see this more in C# than C++.
As for me, not an expert in C++.
What I follow is, I will use methods with respect to C++ and properties with C#.
Will this kind of design really has potential flaw ?
:)