1. Course
  2. OOP
  3. First class and method ToString()

First class and method ToString()


Last updated: 8/23/2020 Difficulty: Intermediate

Create a C# program that requests three names of people from the user and stores them in an array of objects of type Person. To do this, first create a Person class that has a Name property of type string and override the ToString() method.

End the program by reading people and executing the ToString() method on the screen.

Input

Juan
Sara
Carlos

Output

Hello! My name is Juan
Hello! My name is Sara
Hello! My name is Carlos

Solution

OOP

1 / 8

Android App


Practice C# anywhere with the free app for Android devices.

Android App

Exercises C# by difficulty


Learn C# at your own pace, the exercises are ordered by difficulty.

Make a donation


Your donations support our work and contribute to the maintenance of the app.

Advertising