Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi, My program has a pointer arraywith class type( name *array[300] ) , and I ne

ID: 3608946 • Letter: H

Question

Hi,     My program has a pointer arraywith class type( name *array[300] ) , and I need to sortthe IDs in this array with a classfunction,  how do I call the function withall variables in the array. class name {     int ID;     void sort(); }; (here is what I mean if what I said above is notclear,     when you have this array " int a[8] " you can passthe whole array into a function by doing this sort(a); but my array is like this " name *array[300]" and how I do pass this whole array into a classfunction? ) Thanks. Hi,     My program has a pointer arraywith class type( name *array[300] ) , and I need to sortthe IDs in this array with a classfunction,  how do I call the function withall variables in the array. class name {     int ID;     void sort(); }; (here is what I mean if what I said above is notclear,     when you have this array " int a[8] " you can passthe whole array into a function by doing this sort(a); but my array is like this " name *array[300]" and how I do pass this whole array into a classfunction? ) Thanks.

Explanation / Answer

Dear In order to sort thepointer array (double dimension), you can simply define and call anon-member function by passing all the varaibles using thestatement name *a[300] It real applications, youwon't find such a situation where in you need to pass all theobject to the class function or the member function of theclass.
I will definitely solve any problem you come across demanding thatpassing all the objects to the member function if I may be givensome information of its requirement in reality.

Remember that it can be very much possible if linked lists approachis followed. But for the above specified class/definition, we cannot apply the concept of linked list.


Hope the above explanation helps you
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote