C++: it's good programing use functions on a struct?
i know the structure accept functions, but it's a good practice doing it?
Re: C++: it's good programing use functions on a struct?
The only difference from a stuck to a class is how it handles memory. Also the their default access level is public where classes are private. In C it is a necessity but c++ it is interchangeable with a class. Some use Structs for short structures rather then a class. If you are making a car you would want a glass but in that car you may have a seat and you can make 4 seats (structs) in it. This is a bit more readable some say. Though ultimately it is up to you in how you want to do it. It is perfectly OK to put a class in a class.
So in that, sure using functions in a struct is no different then a class.
Re: C++: it's good programing use functions on a struct?
thank you so much for correct me...
i did the question because i started, on past, from Turbo Pascal and then Visual Basic... their structures don't accept functions... so i did the question ;)
i never knew that the C structures accepted functions.. thank you so much for all
Re: C++: it's good programing use functions on a struct?
Quote:
Originally Posted by
cambalinho
thank you so much for correct me...
i did the question because i started, on past, from Turbo Pascal and then Visual Basic... their structures don't accept functions... so i did the question ;)
i never knew that the C structures accepted functions.
Tutuapp 9Apps ShowBox . thank you so much for all
This is a bit more readable some say. Though ultimately it is up to you in how you want to do it. It is perfectly OK to put a class in a class.
So in that, sure using functions in a struct is no different then a class.
Re: C++: it's good programing use functions on a struct?
thank you so much for all to all
Re: C++: it's good programing use functions on a struct?
Quote:
Originally Posted by
GASIYAT
This is a bit more readable some say. Though ultimately it is up to you in how you want to do it. It is perfectly OK to put a class in a class.
Download showbox apk So in that, sure using functions in a struct is no different then a class.
nice answer
Re: C++: it's good programing use functions on a struct?
Quote:
Originally Posted by
GASIYAT
This is a bit more readable some say. Though ultimately it is up to you in how you want to do it. It is perfectly OK to put a class in a class.
So in that, sure using functions in a struct is no different then a class.
9apps download cartoonhd
Thanks for your reply!