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

  1. Juan
  2. Sara
  3. Carlos

Output

  1. Hello! My name is Juan
  2. Hello! My name is Sara
  3. 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


CookieOwn and third party cookies to improve our services. If you go on surfing, we will consider you accepting its use.