View Full Version : C++: it's good programing use functions on a struct?
cambalinho
June 4th, 2019, 20:56
i know the structure accept functions, but it's a good practice doing it?
ulaoulao
June 5th, 2019, 13:59
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.
cambalinho
June 5th, 2019, 21:06
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
GASIYAT
September 16th, 2019, 19:49
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 (https://tutuapp.uno/) 9Apps (https://9apps.ooo/) ShowBox (https://showbox.kim/) . 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.
cambalinho
September 16th, 2019, 20:11
thank you so much for all to all
DESMOND6670
October 14th, 2019, 12:14
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 (https://showbox-dld.com/showbox-apk-download/) So in that, sure using functions in a struct is no different then a class.
nice answer
pinknemo13
April 15th, 2020, 14:08
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 (https://get-9apps.com/index/) cartoonhd (https://get-cartoonhd.com)
Thanks for your reply!
Powered by vBulletin® Version 4.2.4 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.