public object or public function

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

public object or public function

Post by l3whmg »

Hello everyone,
I would like to have your opinion about use of public objects rather than public functions;
maybe it is a scholarly disquisition and difficult (for me) to be addressed in English, so I will use a practical example.

My executable is composed of various sources and I use a public array to store information (for example, the
font name to use in forms); through a public function, I access this array to store or retrieve this information in any source.

Alternatively, I could use a public object (class), which contains an array and function to store or retrieve information.

Basically does not change much more, but I want to understand which of the two methods could be considered more efficient ore less expensive

I hope the explanation and question are clear.

Best regards
Luigi from Italy
www.L3W.it
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: public object or public function

Post by Rathinagiri »

IMHO, both of them are preferable. :) It is the situation that warranties which one we choose. If you re-use the code again and again many times that too by changing one or two array items from the default then and there, then object is preferable since you can just inherit the object and do the changes easily.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: public object or public function

Post by l3whmg »

Hi Rathinagiri,
many thanks for your opinion. I'll try my POW about object with a little project and then I share it on this forum.
Bye
Luigi from Italy
www.L3W.it
Post Reply