1.

State your understanding of Pure Object Oriented Programming Languages. Is Java one? If not, then why?

Answer»

A programming LANGUAGE is referred to as a pure object-oriented language if everything within the program is treated as an object. The pure Object Oriented Programming language does not support primitive types. A pure object-oriented programming language must also satisfy the following properties:

  • Encapsulation: Encapsulation can be defined as the wrapping up of data members and member functions into a single entity. In encapsulation, data and the functions that alter it are bound together in Object-Oriented Programming.
    Let us take a real-world example of encapsulation into consideration: a company has various departments, including accounting, finance, and sales, to name a few. All financial transactions are handled by the finance department, which also keeps TRACK of all financial data. The sales department, therefore, is in charge of all sales-related activities and keeps track of all sales. For whatever reason, an official from the finance department may occasionally request all of the sales data for a specific month. He is not allowed to access the data in the sales area directly in this case. He must first speak with another sales officer and request that he deliver the needed information. It is all about encapsulation. The data from the sales department, as well as the personnel who can affect it, are grouped under the heading "sales division." Data abstraction or hiding is also a result of encapsulation. Because encapsulation hides data, it is a good idea to use it. The data of any of the sections, such as sales, finance, or accounting, is hidden from any other component in the above example.
  • Inheritance: Inheritance refers to a class's capacity to derive features and traits from another class. One of the most significant characteristics of Object-Oriented Programming is inheritance.
    • Sub Class or Derived Class: A Sub Class or Derived Class is a class that inherits properties from another class.
    • Base Class or Super Class: A Base Class or Super Class is a class whose properties are inherited by subclasses.
      Inheritance supports the concept of "reusability," which means that if we want to create a new class but there is already one that contains some of the code we need, we can derive our new class from the old one. We are reusing the old class's fields and functions in this way.
      Dog, Cat, and Cow are examples of Animal Base Class Derived Classes.
  • Polymorphism: Polymorphism refers to the fact that something exists in multiple forms. Polymorphism, in simple terms, is the ability of a message to be displayed in multiple formats. At the same time, a person might have a variety of characteristics. At the same time, he is a father, a spouse, and a worker. As a result, the same person behaves differently in different settings. Polymorphism is the term for this. In different situations, an operation may behave differently. The behaviour is determined by the data types utilised in the operation. Operator and function overloading are supported in C++ which inherit Polymorphism.
    • Operator Overloading: Operator overloading is the process of forcing an operator to behave differently in different situations.
    • Function Overloading: When a single function name is used to accomplish many tasks, this is known as function overloading.
      Inheritance is frequently implemented via polymorphism. An example of Polymorphism is given below:
      Consider the following scenario: We need to construct a function to add several integers; sometimes there are two integers, and other TIMES there are three integers. We can WRITE the sum Method with the same name but different parameters and the method concerned will be invoked based on the parameters.
  • Abstraction: One of the most fundamental characteristics of object-oriented programming in C++ is data abstraction. Abstraction refers to revealing only the most important information while concealing the details. Data abstraction refers to exposing only the most important aspects of the data to the outside world while concealing the IMPLEMENTATION specifics. Consider the case of a man at the wheel of a car. The man only knows that pressing the accelerators will increase the car's speed and that applying the brakes will stop it, but he has no idea how the speed is increased by pressing the accelerators, nor does he understand the car's inner mechanism or how the accelerator, brakes, and other controls are implemented in the car. This is the definition of abstraction. There are two ways in which Abstraction can be implemented:
    • Abstraction using Classes: We may use classes to implement Abstraction in C++. Using the available access specifiers, the class assists us in grouping data members and member functions. A-Class has the ability to control which data members are visible to the outside world and which are not.
    • Abstraction in Header Files: Header files are another sort of abstraction that can be used in C++. Consider the pow() method in the math.h header file, for example. We just call the function pow() in the math.h header file whenever we need to calculate the power of a number and supply the numbers as arguments, without knowing the underlying algorithm through which the function calculates the power of numbers.
      • Objects are all predefined types.
      • Objects are all user-defined types.
      • All operations on objects must be done through methods that have been exposed to the objects.

Because predefined data types are not recognized as objects in Java, it is not a pure object-oriented programming language.



Discussion

No Comment Found