Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Challenge: Create a Book Class | Constructors and Overloading
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
C# OOP Class Construction Drills

bookChallenge: Create a Book Class

Завдання

Swipe to start coding

Practice creating a class with both a default and a parameterized constructor. Your goal is to implement a Book class that can be initialized with or without specifying the title and author.

  • The class must have two public string fields: Title and Author.
  • The default constructor must set both Title and Author fields to "Unknown".
  • The parameterized constructor must accept two string parameters and assign them to the Title and Author fields, respectively.
  • Creating a Book without parameters must initialize it with "Unknown" values.
  • Creating a Book with parameters must initialize it with the provided values.

Рішення

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

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

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

Секція 1. Розділ 2
single

single

Запитати АІ

expand

Запитати АІ

ChatGPT

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

close

bookChallenge: Create a Book Class

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

Завдання

Swipe to start coding

Practice creating a class with both a default and a parameterized constructor. Your goal is to implement a Book class that can be initialized with or without specifying the title and author.

  • The class must have two public string fields: Title and Author.
  • The default constructor must set both Title and Author fields to "Unknown".
  • The parameterized constructor must accept two string parameters and assign them to the Title and Author fields, respectively.
  • Creating a Book without parameters must initialize it with "Unknown" values.
  • Creating a Book with parameters must initialize it with the provided values.

Рішення

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

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

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

Секція 1. Розділ 2
single

single

some-alt