Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Challenge: Static vs Instance Demo | Static Classes and Members
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
C# OOP Class Construction Drills

bookChallenge: Static vs Instance Demo

Taak

Swipe to start coding

Write the complete Vehicle class from scratch, including all required fields, the static member, and the constructor.

  • Define a public static field TotalVehicles to track the total number of vehicles created.
  • Define two public instance fields: Make and Model.
  • Implement a constructor that takes two parameters: make and model.
  • In the constructor, assign the make parameter to the Make field and the model parameter to the Model field.
  • Each time the constructor is called, increment the TotalVehicles static field by one.

Oplossing

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 3. Hoofdstuk 6
single

single

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

Suggested prompts:

Can you explain this in simpler terms?

What are some examples related to this topic?

Where can I learn more about this?

close

bookChallenge: Static vs Instance Demo

Veeg om het menu te tonen

Taak

Swipe to start coding

Write the complete Vehicle class from scratch, including all required fields, the static member, and the constructor.

  • Define a public static field TotalVehicles to track the total number of vehicles created.
  • Define two public instance fields: Make and Model.
  • Implement a constructor that takes two parameters: make and model.
  • In the constructor, assign the make parameter to the Make field and the model parameter to the Model field.
  • Each time the constructor is called, increment the TotalVehicles static field by one.

Oplossing

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 3. Hoofdstuk 6
single

single

some-alt