Challenge: 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:
TitleandAuthor. - The default constructor must set both
TitleandAuthorfields to"Unknown". - The parameterized constructor must accept two string parameters and assign them to the
TitleandAuthorfields, respectively. - Creating a
Bookwithout parameters must initialize it with"Unknown"values. - Creating a
Bookwith parameters must initialize it with the provided values.
Solución
¡Gracias por tus comentarios!
single
Pregunte a AI
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla
Can you explain this in simpler terms?
What are some examples related to this topic?
Where can I learn more about this?
Genial!
Completion tasa mejorada a 4.17
Challenge: Create a Book Class
Desliza para mostrar el menú
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:
TitleandAuthor. - The default constructor must set both
TitleandAuthorfields to"Unknown". - The parameterized constructor must accept two string parameters and assign them to the
TitleandAuthorfields, respectively. - Creating a
Bookwithout parameters must initialize it with"Unknown"values. - Creating a
Bookwith parameters must initialize it with the provided values.
Solución
¡Gracias por tus comentarios!
single