0

Why is Car.newtires not being stored correctly or called correctly.

https://code.sololearn.com/cvLRXSSI08MJ/?ref=app please note _tires is a protected variable and cannot be accessed from the main method

18th Nov 2017, 8:43 PM
kenneth Stanley
kenneth Stanley - avatar
5 Respuestas
0
c9mpare this one to your approach. ReadLine at the start helps the compiler here on sololearn to ask things. also, you have juat messes a dew calls on a _tires and wrote it without _. the property TireAmount was missing a semicolon (why it is set to null when trying to assign it?) if something is unclear, feel free to ask, i can help you a little if possible!
18th Nov 2017, 9:28 PM
Paul
0
Paul I would honestly love to do that but _tires is a private member of the class so I can't directly call it
18th Nov 2017, 10:07 PM
kenneth Stanley
kenneth Stanley - avatar
0
Also null a the default value
18th Nov 2017, 10:08 PM
kenneth Stanley
kenneth Stanley - avatar
0
then when assigning a balue to tires, change it to "newTores.TiresAmount = somevalue;" but change the property TiresAmonut so the "set" part looks like this: _tires = value
19th Nov 2017, 11:19 AM
Paul