arrays | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок


how to program an array when the objects are text i have the variable here but what do you do to draw it randomly.

1st Nov 2019, 3:04 PM
3 ответов
+ 3
jessie Please follow this guide for posting a question
1st Nov 2019, 3:36 PM
+ 1
I think you want to say "How to pass objects as an array or arrays of object !!" If yes here you go.... In c++ int main () { int size = 3 BOOK book[size] ; //BOOK is class and book is object for(int i=0;i<size;i++) { book[i].getdata();//getdata() is function inside BOOK class } In java: BOOK obj[] = new BOOK[2] ; //BOOK is class obj[0].setData(1,2); obj[1].setData(3,4); obj[0].showData(); obj[1].showData(); //setdata() and showdata() are function in class BOOK If this is what you want !! All the best :)
1st Nov 2019, 3:54 PM
Chirag Kumar
Chirag Kumar - avatar
Can you paste the code.
1st Nov 2019, 3:32 PM
Inkosi - avatar