Skip to content

Commit aa06c68

Browse files
authored
changed files by pdets auto publish service, publishid[25034cfe-df25-4211-aa85-2489df87af38] and do [publish].
1 parent 161ef5f commit aa06c68

19 files changed

+1701
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.implement-class-inheritance.introduction
3+
title: Introduction
4+
metadata:
5+
title: Introduction
6+
description: "Introduction"
7+
ms.date: 03/04/2025
8+
author: wwlpublish
9+
ms.author: cahowd
10+
ms.topic: unit
11+
durationInMinutes: 3
12+
content: |
13+
[!include[](includes/01-introduction.md)]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.implement-class-inheritance.examine-principals-inheritance
3+
title: Examine the principals of class inheritance
4+
metadata:
5+
title: Examine the principals of class inheritance
6+
description: "Examine the principals of class inheritance."
7+
ms.date: 03/04/2025
8+
author: wwlpublish
9+
ms.author: cahowd
10+
ms.topic: unit
11+
durationInMinutes: 6
12+
content: |
13+
[!include[](includes/2-examine-principals-inheritance.md)]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.implement-class-inheritance.configure-base-derived-classes
3+
title: Configure base and derived classes
4+
metadata:
5+
title: Configure base and derived classes
6+
description: "Configure base and derived classes."
7+
ms.date: 03/04/2025
8+
author: wwlpublish
9+
ms.author: cahowd
10+
ms.topic: unit
11+
durationInMinutes: 11
12+
content: |
13+
[!include[](includes/3-configure-base-derived-classes.md)]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.implement-class-inheritance.examine-derived-class-new-members
3+
title: Extend a derived class with new members
4+
metadata:
5+
title: Extend a derived class with new members
6+
description: "Extend a derived class with new members."
7+
ms.date: 03/04/2025
8+
author: wwlpublish
9+
ms.author: cahowd
10+
ms.topic: unit
11+
durationInMinutes: 11
12+
content: |
13+
[!include[](includes/4-examine-derived-class-new-members.md)]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.implement-class-inheritance.override-properties-methods-derived-class
3+
title: Override properties and methods in a derived class
4+
metadata:
5+
title: Override properties and methods in a derived class
6+
description: "Override properties and methods in a derived class."
7+
ms.date: 03/04/2025
8+
author: wwlpublish
9+
ms.author: cahowd
10+
ms.topic: unit
11+
durationInMinutes: 11
12+
content: |
13+
[!include[](includes/5-override-properties-methods-derived-class.md)]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.implement-class-inheritance.access-base-class-members-derived-class
3+
title: Access base class members from a derived class
4+
metadata:
5+
title: Access base class members from a derived class
6+
description: "Access base class members from a derived class."
7+
ms.date: 03/04/2025
8+
author: wwlpublish
9+
ms.author: cahowd
10+
ms.topic: unit
11+
durationInMinutes: 10
12+
content: |
13+
[!include[](includes/6-access-base-class-members-derived-class.md)]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.implement-class-inheritance.exercise-implement-base-derived-classes
3+
title: Exercise - Implement base and derived classes
4+
metadata:
5+
title: Exercise - Implement base and derived classes
6+
description: "Exercise - Implement base and derived classes."
7+
ms.date: 03/04/2025
8+
author: wwlpublish
9+
ms.author: cahowd
10+
ms.topic: unit
11+
durationInMinutes: 30
12+
content: |
13+
[!include[](includes/7-exercise-implement-base-derived-classes.md)]
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.implement-class-inheritance.knowledge-check
3+
title: Knowledge check
4+
metadata:
5+
title: Knowledge check
6+
description: "Knowledge check"
7+
ms.date: 03/04/2025
8+
author: wwlpublish
9+
ms.author: cahowd
10+
ms.topic: unit
11+
durationInMinutes: 3
12+
quiz:
13+
title: "Check your knowledge"
14+
questions:
15+
- content: "What does the colon (:) character indicate in the declaration of a derived class in C#?"
16+
choices:
17+
- content: "It indicates that the derived class is implementing an interface."
18+
isCorrect: false
19+
explanation: "Incorrect. The colon (:) character in C# is used to indicate inheritance, not interface implementation."
20+
- content: "It indicates that the derived class is defining a new property or method."
21+
isCorrect: false
22+
explanation: "Incorrect. The colon (:) character in C# is used to indicate inheritance, not the definition of new properties or methods."
23+
- content: "It indicates that the derived class is inheriting from a base class."
24+
isCorrect: true
25+
explanation: "Correct. In C#, the colon (:) character is used in the declaration of a derived class to indicate that it's inheriting from a base class."
26+
- content: "What is the effect of the 'sealed' keyword in C# inheritance?"
27+
choices:
28+
- content: "It allows a method to be overridden in derived classes."
29+
isCorrect: false
30+
explanation: "Incorrect. The 'sealed' keyword prevents a method from being overridden in derived classes."
31+
- content: "It allows a class to be used as a base class for other classes."
32+
isCorrect: false
33+
explanation: "Incorrect. The 'sealed' keyword prevents a class from being used as a base class for other classes."
34+
- content: "It prevents a class or class member from being inherited or overridden."
35+
isCorrect: true
36+
explanation: "Correct. The 'sealed' keyword in C# is used to prevent a class or class member from being inherited or overridden."
37+
- content: "What is the purpose of using the 'new' keyword when defining members in a derived class?"
38+
choices:
39+
- content: "To hide base class members intentionally or to avoid accidental overriding of base class members."
40+
isCorrect: true
41+
explanation: "Correct. The 'new' keyword allows you to define new members in a derived class that have the same name as members in the base class. The 'new' keyword hides the corresponding base class members."
42+
- content: "To create a new instance of the derived class."
43+
isCorrect: false
44+
explanation: "Incorrect. The 'new' keyword doesn't create a new instance of the derived class."
45+
- content: "To override the base class members with the same name."
46+
isCorrect: false
47+
explanation: "Incorrect. The 'new' keyword doesn't override base class members."
48+
- content: "What is the purpose of the 'override' keyword in C#?"
49+
choices:
50+
- content: "It indicates that the member has no implementation and must be overridden in a derived class."
51+
isCorrect: false
52+
explanation: "Incorrect. The 'override' keyword doesn't indicate that the member has no implementation and must be overridden in a derived class. This definition matches the `abstract` keyword."
53+
- content: "It indicates that the base class member is extended or modified in the derived class."
54+
isCorrect: true
55+
explanation: "Correct. The 'override' keyword in C# is used to extend or modify the behavior of the base class. Overriding provides custom implementations for properties and methods inherited from the base class."
56+
- content: "It indicates that the derived class hides members of the base class with new implementations."
57+
isCorrect: false
58+
explanation: "Incorrect. The 'override' keyword doesn't hide members of the base class with new implementations in the derived class. This definition matches the `new` keyword."
59+
- content: "What is the purpose of the `base` keyword in a derived class?"
60+
choices:
61+
- content: "To access derived class members from a base class."
62+
isCorrect: false
63+
explanation: "Incorrect. The `base` keyword is used in a derived class to access members of the base class, not the other way around."
64+
- content: "To access base class members from a derived class."
65+
isCorrect: true
66+
explanation: "Correct. The `base` keyword is used in a derived class to access members of the base class, including methods, properties, and constructors."
67+
- content: "To specify which derived-class constructor should be called when creating instances of the base class."
68+
isCorrect: false
69+
explanation: "Incorrect. The `base` keyword is used in a derived class to specify which base-class constructor should be called when creating instances of the derived class."
70+
- content: "What is the primary purpose of implementing base and derived classes in C#?"
71+
choices:
72+
- content: "To reduce the amount of code needed for each class."
73+
isCorrect: false
74+
explanation: "Incorrect. Although implementing base and derived classes can sometimes reduce the amount of code, reducing the amount of code isn't the primary purpose of implementing base and derived classes."
75+
- content: "To establish a hierarchy of classes that share common attributes and behaviors."
76+
isCorrect: true
77+
explanation: "Correct. Base and derived classes are used to establish a hierarchy of classes that share common attributes and behaviors, promoting reusability and organization."
78+
- content: "To create multiple instances of the same class."
79+
isCorrect: false
80+
explanation: "Incorrect. While it's possible to create multiple instances of a class, creating instances of the same class isn't the primary purpose of implementing base and derived classes."
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.implement-class-inheritance.summary
3+
title: Summary
4+
metadata:
5+
title: Summary
6+
description: "Summary"
7+
ms.date: 03/04/2025
8+
author: wwlpublish
9+
ms.author: cahowd
10+
ms.topic: unit
11+
durationInMinutes: 3
12+
content: |
13+
[!include[](includes/9-summary.md)]
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Class inheritance is a fundamental concept in object-oriented programming. Inheritance enables the creation of class hierarchies, promotes code reuse, and extensibility. This module focuses on understanding and implementing inheritance in C#.
2+
3+
Imagine you're working at a non-profit company that's in the midst of a software update project. The application's complexity requires a modular and reusable code structure, and you're concerned about code readability, maintainability, and organization. You need to understand how to implement a class hierarchy that implements inheritance and support polymorphic behavior. This module guides you through these concepts and provides practical examples to help you apply them in your work.
4+
5+
The topics covered in this module include:
6+
7+
- Understanding Class Inheritance and Polymorphism in C#
8+
- Understanding Inheritance, Member Visibility and Keywords in C#
9+
- Extending Derived Classes with New Members and Resolving Naming Conflicts
10+
- Overriding and Hiding Properties and Methods in Derived Classes in C#
11+
- Using the 'base' Keyword to Access Base Class Members from a Derived Class
12+
- Implementing Base and Derived Classes in C# - Exercise
13+
14+
After completing this module, you're able to:
15+
16+
- Explain the principals of class inheritance.
17+
- Describe the default characteristics of a derived class.
18+
- Control the visibility of inherited members using access modifiers and keywords like `abstract`, `virtual`, and `sealed`.
19+
- Describe the use of `new` and `override` keywords in a derived class.
20+
- Override properties and methods in a derived class.
21+
- Access base class members in a derived class.
22+
- Implement base and derived classes in a C# program.
23+
24+
By the end of this module, you have a solid understanding of class inheritance in C# and be able to implement a class hierarchy using base and derived classes.

0 commit comments

Comments
 (0)