Hands-On Object-Oriented Programming with C#
Build maintainable software with reusable code using C#
Raihan Taher
BIRMINGHAM - MUMBAI
Hands-On Object-Oriented Programming with C#
Copyright 2019 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Commissioning Editor: Aaron Lazar
Acquisition Editor: Sandeep Mishra
Content Development Editor: Anugraha Arunagiri
Technical Editor: Neha Pande
Copy Editor: Safis Editing
Language Support Editors : Mary McGowan, Storm Mann
Project Coordinator: Ulhas Kambali
Proofreader: Safis Editing
Indexer: Priyanka Dhadke
Graphics: Tania Dutta
Production Coordinator: Aparna Bhagat
First published: February 2019
Production reference: 2140519
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78829-622-9
www.packtpub.com
mapt.io
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
Packt.com
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.packt.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at customercare@packtpub.com for more details.
At www.packt.com , you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Contributors
About the author
Raihan Taher is a young, skilled software developer who has gained extensive experience by being involved in a variety of projects throughout his career. His particular areas of interest are web development and software architecture. His ability to write clean code and observe best practices in software development are his major assets. Throughout his relatively short career, he has worked for a number of renowned multinational companies, including Accenture, Quintiq (Dassault Systmes), and SEB Pension. His desire to share his knowledge has encouraged him to write technical blogs, create online video courses, write books, and conduct technical training sessions. His courses, blog posts, and books have already been well received by many new developers. As regards the future, his vision is to discover and establish best practices for software development and share those with fellow developers. His ability to write quality software is what makes him accomplished. Aside from this, he is an avid reader and is excited by the challenge of learning new things. He always pushes himself to learn and implement new technologies in his work. Keeping himself up to date with new technologies and implementing those in his work makes him an expert in the area of cutting-edge technologies. He also loves to travel and explore adventurous places with his wife.
About the reviewer
Gaurav Aroraa completed his M.Phil in computer science. He is a Microsoft MVP, a lifetime member of the Computer Society of India (CSI), an advisory member of IndiaMentor, and is certified as a scrum trainer/coach, XEN for ITIL-F, and APMG for PRINCE-F and PRINCE-P. Gaurav is an open source developer, and the founder of Ovatic Systems Private Limited. Recently, he was conferred as icon of the yearexcellence in mentoring technology start-ups for the year 2018-19 by Radio City, a Jagran initiative, for his extraordinary work during his 20-year career in industry in the field of technology mentoring. You can tweet Gaurav on his Twitter handle: @g_arora.
Packt is searching for authors like you
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Preface
Object-oriented programming (OOP) is a programming paradigm organized around objects rather than actions, and data rather than logic. With the newest release of C#, there are a number of new additions that improve OOP. This book aims to teach OOP in C# in an engaging and interactive way. After going through the book, y ou will have an understanding of the four pillars of OOP, which are encapsulation, inheritance, abstraction, and polymorphism, and be able to leverage the latest features of C# 8.0, such as Nullable Reference Types and Asynchronous Streams. You will then explore various design patterns, principles, and best practices in OOP.
Who this book is for
This book is intended for people who are new to OOP. It assumes that you already have basic C# skills. No knowledge of OOP in any other language is expected.
What this book covers
, Overview of C# as a Language, covers a basic overview of the C# programming language to enable the beginner to understand the language constructs. The chapter will also explain why .NET exists as a framework and how to utilize the .NET framework in programs. The chapter will conclude by introducing Visual Studio as an editor for developing C# projects.
, Hello OOP - Classes and Objects , explains the most basic concepts of object-oriented programming. We start by explaining what a class is and how to write a class.
Next page