Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen 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

Aufgabe

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.

Lösung

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 3. Kapitel 6
single

single

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

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

Swipe um das Menü anzuzeigen

Aufgabe

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.

Lösung

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 3. Kapitel 6
single

single

some-alt