i know the structure accept functions, but it's a good practice doing it?
i know the structure accept functions, but it's a good practice doing it?
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.
Last edited by ulaoulao; June 5th, 2019 at 14:04.
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
Last edited by GASIYAT; September 16th, 2019 at 20:32.
thank you so much for all to all
There are currently 1 users browsing this thread. (0 members and 1 guests)