Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Compose a Computer Class | Composition, Inheritance, and Refactoring
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
C# OOP Class Construction Drills

bookChallenge: Compose a Computer Class

Oppgave

Swipe to start coding

Practice composition by building a Computer class that contains other component classes. In this task, you will implement a Computer class that holds references to CPU, RAM, and Storage objects as its fields.

  • Add fields to the Computer class for CPU, RAM, and Storage.
  • Implement a constructor for Computer that takes CPU, RAM, and Storage objects as parameters and assigns them to the corresponding fields.
  • Add a method GetSpecs() to the Computer class that returns a string combining the results of calling GetInfo() on each component.

Løsning

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 4. Kapittel 2
single

single

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

close

bookChallenge: Compose a Computer Class

Sveip for å vise menyen

Oppgave

Swipe to start coding

Practice composition by building a Computer class that contains other component classes. In this task, you will implement a Computer class that holds references to CPU, RAM, and Storage objects as its fields.

  • Add fields to the Computer class for CPU, RAM, and Storage.
  • Implement a constructor for Computer that takes CPU, RAM, and Storage objects as parameters and assigns them to the corresponding fields.
  • Add a method GetSpecs() to the Computer class that returns a string combining the results of calling GetInfo() on each component.

Løsning

Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 4. Kapittel 2
single

single

some-alt