Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Challenge: Compose a Computer Class | Composition, Inheritance, and Refactoring
C# OOP Class Construction Drills

bookChallenge: Compose a Computer Class

Compito

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.

Soluzione

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 4. Capitolo 2
single

single

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

close

bookChallenge: Compose a Computer Class

Scorri per mostrare il menu

Compito

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.

Soluzione

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 4. Capitolo 2
single

single

some-alt