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

bookChallenge: Inherit from Person

Tarefa

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.

Solução

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 4. Capítulo 6
single

single

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

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

Deslize para mostrar o menu

Tarefa

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.

Solução

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 4. Capítulo 6
single

single

some-alt