Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 128 - CoreGPT(Podar)_Flipbook_C8
P. 128

    OBJECT-ORIENTED PROGRAMMING

                      C++ focuses on objects rather than just step-by-step instructions. Objects are real-world entities
                      that contain both data (variables) and functions (methods) that operate on the data. This makes
                      programming more structured, reusable and easier to manage.

                      Example: If we create a program for a car, we can make a Car object that contains properties
                      (like colour, speed) and functions (like start, stop).
                          Class: Think of a human being as a class. A class is essentially a blueprint for creating objects,
                          defining their properties and functions. Just as a human has various body parts and can
                          perform actions, a class describes both attributes and behaviours.

                          Inheritance: Now, imagine that the class "Human Being" has properties like hands, legs and
                          eyes, along with functions such as walking, talking, eating and seeing. The classes "Male"
                          and "Female" can inherit most of these properties and behaviours from the "Human Being"
                          class. This is what inheritance means – the ability to take on properties and functions from
                          another class.

                          Objects: An object is a specific instance of a class. For example, Viraj is an object of the class
                          "Male." When we talk about human beings, males or females, we are referring to general
                          categories. However, specific people, like you, your friend or your teacher, are objects that
                          belong to these classes.
                          Abstraction: Abstraction involves hiding the complex details and showing only the essential
                          information. For humans, this means that while we can perform actions like walking, talking,
                          eating and hearing, the internal workings are hidden. Think of the skin as a form of abstraction,

                          concealing the internal organs and mechanisms from the outside world.
                          Encapsulation: Encapsulation refers to the binding of properties and functions together. In
                          humans, this is like how our legs help us walk and our hands help us hold things. By keeping
                          the related  properties  (like legs) and  functions (like walking)  together,  we  create  a well-
                          organised system.

                          Polymorphism: Polymorphism allows us to redefine how something works. Just as humans
                          can perform the same function in different ways – for example, walking with different styles
                          or using various tools to perform tasks – polymorphism allows for flexibility in how actions or
                          behaviours are executed.

                            FEATURES OF C++

                      Some of the important features of C++ language are:
                          Platform Independent: C++ is a platform-independent language, meaning that a program
                          written in C++ can run on different operating systems with little or no modification. If a
                          program is written and compiled on Windows, it can also run on Linux, MacOS or other
                          operating systems, as long as a compatible C++ compiler is available.

                    126     Premium Edition-VIII

| 123 124 125 126 127 128 129 130 131 132 133 |