Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele Challenge: Design a Contact Class | Class Design and Encapsulation
C# OOP Class Construction Drills

bookChallenge: Design a Contact Class

Tehtävä

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.

Ratkaisu

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 2. Luku 2
single

single

Kysy tekoälyä

expand

Kysy tekoälyä

ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

close

bookChallenge: Design a Contact Class

Pyyhkäise näyttääksesi valikon

Tehtävä

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.

Ratkaisu

Switch to desktopVaihda työpöytään todellista harjoitusta vartenJatka siitä, missä olet käyttämällä jotakin alla olevista vaihtoehdoista
Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 2. Luku 2
single

single

some-alt