Hello OOP - Classes and Objects

Object-oriented programming (OOP) is something special. If you search the internet for books on OOP, you'll find hundreds of books on this topic. But still this topic will never become stale as it is the most efficient and most commonly used programming methodology in the industry. With the increase in the demand for software developers, there has also been an increase in the demand for good learning content. Our approach in this book is to describe the concepts of OOP in the simplest way. Understanding the basics of OOP is a must for developers who want to work with C#, as C# is a fully OOP. In this chapter, we will try to understand what OOP actually is and the most basic concepts of OOP that are essential to begin our programming journey. Before anything else, let's first start by analyzing the meaning of the term Object-oriented programming.

The first word is object. According to the dictionary, an object is something that can be seen, felt, or touched, something that has physical existence in the real world. If an item is virtual, this means that it doesn't have any physical existence and is not considered an object. The second word is oriented, which indicates a direction or something to aim for. For example, when we say that we are oriented toward the building, we mean that we are facing towards it. The third word is programming. I believe I don't have to explain what programming is, but in case you are totally unaware of what programming is and are reading this book to learn, let me explain briefly what programming is. Programming is just giving instructions to the computer. As the computer doesn't speak our language, we humans have to give instructions to the computer in the language that the computer understands. We humans call these instructions computer programs, as we are guiding or instructing a computer to do a particular thing.

Now, that we know the definitions of those three keywords, if we put all these words together, we can understand the meaning of the phrase Object-oriented programming. OOP means that we write our computer programs by keeping objects at the center of our thinking. OOP is neither a tool nor a programming language—it is just a concept. Some programming languages are designed to follow this concept. C# is one of the most popular object-oriented languages. There are other object-oriented languages, such as Java, C++, and so on.

In OOP, we try to think about our software components as small objects and create relationships between them to solve a problem. You may have came across this approach with other programming concepts in the programming world, such as procedural programming, functional programming, and other kinds of programming. One of the most popular computer programming languages of all time—the C programming language—is a procedural programming language. F# is an example of a functional programming language.

In this chapter, we will cover the following topics of OOP:

  • Classes in OOP
  • The general form of a class
  • What is an object?
  • Methods in a class
  • Characteristics of OOP
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.249.198