Why C++ is partially Object Oriented Language?
As we know some basic features of an object oriented programming language are the Inheritance, Encapsulation, Polymorphism. Any language that supports these features completely are known as object oriented programming languages. Some languages like C++ supports these three but not fully, so they are partially object oriented language. Let us see the reason why C++ is not known as completely object oriented language.
- In C++, we need the main() function to start executing, but in C++, the main functions are not present inside the class. So we can also write code without using class in C++. Some OOP languages like JAVA, it needs one class same as file name, the main function is present inside that.
- In C++, we can use the global variables. That can be accessed from anywhere. It does not complete privacy to the data, as no one can be restricted to access and modify those data, so it ensures encapsulations partially. In JAVA, we can use variables in class, and also use the access specifier on them.
- C++ has the concept of friend functions. Using friend functions, we can access private and protected members of one class. It also violets the concept of OOL. Java does not support friend functions in it.
Published on 18-Dec-2019 10:13:22