Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Challenge: Inherit from Person | Composition, Inheritance, and Refactoring
C# OOP Class Construction Drills

bookChallenge: Inherit from Person

Завдання

Swipe to start coding

Practice using inheritance by building on your knowledge from previous chapters. Your goal is to implement a base class and a derived class using proper constructors and field initialization.

  • Define a Person class with two public properties: Name and Age.
  • Implement a constructor in Person that initializes the Name and Age properties.
  • Define a Student class that inherits from Person.
  • Add a public property StudentId to Student.
  • Implement a constructor in Student that takes parameters for name, age, and studentId, and initializes all three properties appropriately.

Рішення

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 4. Розділ 6
single

single

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

Suggested prompts:

Can you explain this in more detail?

What are the next steps I should take?

Can you provide an example?

close

bookChallenge: Inherit from Person

Свайпніть щоб показати меню

Завдання

Swipe to start coding

Practice using inheritance by building on your knowledge from previous chapters. Your goal is to implement a base class and a derived class using proper constructors and field initialization.

  • Define a Person class with two public properties: Name and Age.
  • Implement a constructor in Person that initializes the Name and Age properties.
  • Define a Student class that inherits from Person.
  • Add a public property StudentId to Student.
  • Implement a constructor in Student that takes parameters for name, age, and studentId, and initializes all three properties appropriately.

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 4. Розділ 6
single

single

some-alt