Skip to Main Content
C# 10.0 All-in-One For Dummies
book

C# 10.0 All-in-One For Dummies

by John Paul Mueller
March 2022
Intermediate to advanced content levelIntermediate to advanced
864 pages
19h 46m
English
For Dummies
Content preview from C# 10.0 All-in-One For Dummies

Chapter 6

Poly-what-ism?

IN THIS CHAPTER

Bullet Hiding or overriding a base class method

Bullet Building abstract classes and methods

Bullet Using ToString()

Bullet Sealing a class from being subclassed

In inheritance, one class adopts the members of another. Thus it's possible to create a class SavingsAccount that inherits data members, such as account id, and methods, such as Deposit(), from a base class BankAccount. That's useful, but this definition of inheritance isn’t sufficient to mimic what’s going on out there in the business world. (See Chapter 5 of this minibook if you don’t know or remember much about class inheritance.)

A microwave oven is a type of oven, not because it looks like an oven, but rather because it performs the same functions as an oven. A microwave oven may perform additional functions, but it performs, at the least, the base oven functions, such as heating food. It’s not important to know what the oven must do internally to make that happen, any more than it’s important to know what type of oven it is, who made it, or whether it was on sale when purchased.

From a human vantage point, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C# Cookbook

C# Cookbook

Joe Mayo
Head First C#, 4th Edition

Head First C#, 4th Edition

Andrew Stellman, Jennifer Greene

Publisher Resources

ISBN: 9781119839071Purchase Link