I have objects School(day, class,teacher,headmaster) and I want to create an array of days for example. Can I and how? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I have objects School(day, class,teacher,headmaster) and I want to create an array of days for example. Can I and how?

14th Nov 2020, 11:56 PM
Настя Чумак
Настя Чумак - avatar
4 Answers
+ 4
Like days of the week? I.E. Monday, Tuesday, Wednesday, etc If so you may be better off with an enum
15th Nov 2020, 12:00 AM
ChaoticDawg
ChaoticDawg - avatar
+ 3
Then you just make an array like you would any other. You just use whatever data type day is or if day itself is a custom data type (object) then you use day as the type.
15th Nov 2020, 12:08 AM
ChaoticDawg
ChaoticDawg - avatar
+ 2
Post the definition of your `School` type and also the full type of `findMaxClass`, including the return type, maybe then we can figure something out. At the moment it's not clear what `findMaxClass` is supposed to do, to me anyway.
15th Nov 2020, 1:04 AM
Schindlabua
Schindlabua - avatar
0
No, I have a task to create a function for example findMaxClass (School*, day) . So I have to find the biggest value on some day. As a result, I think , I have to create an array
15th Nov 2020, 12:04 AM
Настя Чумак
Настя Чумак - avatar