#checkTruck( Truck truck) -truck is the name of the object Truck- but not defined anywhere)

1 messages · Page 1 of 1 (latest)

dusky bramble
#

Why can I write checkTruck(Truck truck) since Truck isn´t defined anywhere

ornate pathBOT
#

This post has been reserved for your question.

Hey @dusky bramble! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

crude scroll
#

and also u can just do:

return truck.weight <= maxWeight;
dusky bramble
#

coul you explain why that is possible since the object Truck is nowhere defined

#

andthanks for the tip

ornate pathBOT
# dusky bramble andthanks for the tip

If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.

crude scroll
dusky bramble
#

what do you mean?

#

that was the whole code

crude scroll
#

hm, well what do u mean "Truck is nowhere defined"

#

the class Truck doesnt exist or what?

dusky bramble
#

no the data class is BridgeOfficer

#

that is why I am confused as to why you can build a reference here

crude scroll
#

im out