Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Challenge: Inherit from Person | Composition, Inheritance, and Refactoring
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
C# OOP Class Construction Drills

bookChallenge: Inherit from Person

Aufgabe

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.

Lösung

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 4. Kapitel 6
single

single

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

close

bookChallenge: Inherit from Person

Swipe um das Menü anzuzeigen

Aufgabe

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.

Lösung

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 4. Kapitel 6
single

single

some-alt