Erhalten Sie Zugang zu diesem und mehr als 300000 Büchern ab EUR 5,99 monatlich.
This book helps interested audiences to get familiar with the basics of the object-oriented programming paradigm in C# faster, for the author has written this book in the simple language, used extremely simple examples; however, being at least junior level in C#.Net is preferred. Moreover, the important points have emboldened and underlined too.
Sie lesen das E-Book in den Legimi-Apps auf:
Seitenzahl: 47
Veröffentlichungsjahr: 2019
Das E-Book (TTS) können Sie hören im Abo „Legimi Premium” in Legimi-Apps auf:
THE BASIC CONCEPTS OF OOP IN C#
LEARN CONCEPTUALLY IN SIMPLE LANGUAGE
University of applied science and technology
Hani Marzban
Copyright © 2018 by Hani Marzban
All rights reserved. No part of these publications may be reproduced, distributed, or transmitted in any form or by any means, including photocopying, recording, or other electronic or mechanical methods, without the prior written permission of the publisher, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to the publisher, addressed “Attention: Permissions Coordinator,” at [email protected].
Table of Contents
Preface
Introduction
The concept of an object
The Properties of an object
The Behaviors
The Methods
The fields
The Accessor
The Namespaces
The concept of a Class
The Concept of a struct
Differences between class and struct
The constructors
The destructors
The re-usability
The abstraction
The encapsulation
The Property
The Inheritance
The interface
The Polymorphism
Practical exercises
How to create a class
Declaration of a class in C#
Declaration of a method in C#
Calling Methods in C#
How to use constructors
How to use DEstructors
The Property and encapsulation
Struct
“Reference Type” and “Value type”
The inheritance
The constructors in inheritance
The abstraction
Static and non-static class
The interface
The polymorphism
Researching in various areas of computer science has been the author’s most favorite work to do from a long time ago. This time he has decided to write a book about the preliminary topics in the object-oriented programming paradigm in C# programming language, which is considered to be one of the most popular ones thanks to the powerful “Dot NET framework.”
This book helps interested audiences to get familiar with the basics of the object-oriented programming paradigm in C# faster, for he has written this book in the simplest possible language, used very simple examples; however, being a mid-level C#.Net developer is a prerequisite. Moreover, the author has emboldened and underlined important points too.
Hence, expected that readers find this book useful, although, study without practical practice is worth nothing in programming; therefore, remember that “practice is the key.”
Hopefully, to enjoy reading this book as much as the author enjoyed writing it, and please do not hesitate to send possible suggestions, corrections, and errors at [email protected] because the author warmly considers it.
Ultimately, the author would like to present this book to the great soul of the late Professor Maryam Mirzakhani, the legendary Iranian mathematician, and the winner of the Field medal in 2014. Sheis a light in the way of doing scientific investigations, perseverance, and dignity for us.
Hani Marzban, January 19, 2019
Maybe readers have heard about “Object-Oriented,” or have heard that this could be the hardest-to-understand concept inprogrammingespecially if you are a newbie in this or having a plan to get into the community of coders? So, we assure that this is hard no more.
However, this could be true at the beginning of programming age, but fortunately it has become pretty much easier and understandable more than ever with the advent of HLL1 of programming such as C, C++, C#2, Visual Basic, and etcetera., which helped programmers to comprehend the main concept of OOP3paradigmmore,like never before.
Well, there are benefits for the programmers using OOP paradigm, such as having a high-performance piece of codes, re-usability, which is considered to be a principle in OOP and literally as the foundation of OOP. Debugging codes are easy to do, so this way, the audience will not get involved with tons of complex lines of codes and also developing and modification of codes are easy to deal with, too.
Ultimately, in this book, we will have a closer look at the OOP paradigm in practice using C# language, and surely by relying on different examples, achieving a high level of ability in OOP paradigm will become true. Do not forget that “practice is the key.” We wish dear readers all the success in this.
Whatever we see, whatever we feel or even imagine in the real world is counted as an object. Usually, we work with different types of objects in the daily life, such as Computers, Mobile phones, Televisions, and etcetera. So, it is the same in the world of the computer. As an instance, OS4 applications are called objects like, media players, toolbars, buttons, windows and what we could observe, these are the visible objects; on the other hand, there are hidden objects too, we cannot see, but they are working behind the scene, technically, a bunch of codes letting visible objects to run and be controlled. Each object as an entity contains two main factors, “properties” and “behaviors,” which I will describe them later. So, for now, let us clear the definition of an object using an example.
Firstly, before creating an object, we need to analyze the essential properties and behaviors of an object. Imagine we have a plan to build software for managing a library, so surely after analyzing the needs, for example, we find primary objects in which
