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

Oppgave

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.

Løsning

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

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

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

Sveip for å vise menyen

Oppgave

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.

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

single

some-alt