Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Challenge: Design a Contact Class | Class Design and Encapsulation
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
C# OOP Class Construction Drills

bookChallenge: Design a Contact Class

Compito

Swipe to start coding

Create a Contact class to represent a person's contact information for an address book application.

  • The Contact class must have three private fields: name, phone, and email.
  • You must implement a constructor that takes three parameters (name, phone, email) and assigns them to the corresponding private fields.
  • Implement a public method named GetName that returns the value of the name field.
  • Implement a public method named GetPhone that returns the value of the phone field.
  • Implement a public method named GetEmail that returns the value of the email field.

Soluzione

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 2. 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

Suggested prompts:

Can you explain this in simpler terms?

What are the main takeaways from this?

Can you give me a real-world example?

close

bookChallenge: Design a Contact Class

Scorri per mostrare il menu

Compito

Swipe to start coding

Create a Contact class to represent a person's contact information for an address book application.

  • The Contact class must have three private fields: name, phone, and email.
  • You must implement a constructor that takes three parameters (name, phone, email) and assigns them to the corresponding private fields.
  • Implement a public method named GetName that returns the value of the name field.
  • Implement a public method named GetPhone that returns the value of the phone field.
  • Implement a public method named GetEmail that returns the value of the email field.

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 2. Capitolo 2
single

single

some-alt