I read about small talk being completely object oriented.. is C++ also completely object oriented? if no.. then why so??
相关问题
- how to define constructor for Python's new Nam
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Keeping track of variable instances
- Why does const allow implicit conversion of refere
相关文章
- 接口B继承接口A,但是又不添加新的方法。这样有什么意义吗?
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
- Converting glm::lookat matrix to quaternion and ba
C++ is not a pure object oriented language, and as already mentioned nothing forces you to use OOP concepts in C++. C++ is what you call a hybrid object oriented language, as it's based on C which is purely a procedural language.
Examples of pure object oriented languages are C# and JAVA.
The short answer is no - C++ is not entirely OO language. You can write "not exactly" OOP using C++ even without resorting to using the C subset. One such example is your main method - which is not contained in any class.
The main reason is the fact that C++ originated from C - when Stroustrup created the language he was aiming to create a new version of C (with classes). in fact he have tried to submit his creation as the new flavor of C (C84).
The reason why C++ is not a OOP language is mainly because it is missing the concept of encapsulation. You can't define an interface/contract to your object because of the pointers which give you total control on everything.
C++ is nothing but "C with classes". I can still write a C program and save it as .cpp file. So, Proof by implication says "C++ is not a purely object oriented language."
C++ contains a 'C' dialect as a subset, permitting a purely procedural style of code.
No, it is not a purely object oriented language. In particular primitive datatypes in C++ have rules that are frequently different from datatypes that aren't primitive. Additionally it is possible to have functions that are not associated with any datatype at all. There are a myriad of other ways in which C++ is not a pure object oriented language, but those are two of the biggest reasons.
Neither Java nor C# are pure object oriented languages either because they have primitive datatypes that do not obey the same semantics as 'object' datatypes.