+ 5
In C++, we use pointer. While, In java, we do not use pointer ; But both are "Object Oriented Programming", then why is it so?
Memory leak from variables
12 Antworten
+ 8
Usage of pointers has nothing to do with OOP; it is a memory management resource. A language is OOP if it is focused on programming using classes, and those classes may or may not contain pointers.
+ 5
You're comparing apples and oranges. C++ allow you to access low-level components of software and hardware. Java, on the otherhand, is a language for internet. Two entirely different concept
+ 3
Firstly, using pointers or not has nothing to do with object oriented programming.
C++ isn't object oriented. It supports object oriented programming. Its just one of the programming paradigms that C++ supports (just like it supports functional programming, generic programming, etc...).
Java, the language itself, is based on C++ and yes, programmers don't have access to pointers in it but Java IS using pointers. Infact, every object you create in java is a pointer by default. It shouldn't be very surprising since it's based on C++. You just can't change it like you can do it in C++.
That's why
+ 2
But C++ is general purpose object oriented programming language. And java also an object oriented. In C++, we can make classes as well as objects, while in java also it is happened. But like smart pointer, java dosent support this! Why?
+ 2
what is a object : a class
c++ have classes
java has classes
c++ is oop
java is oop
+ 2
Iraj, in short, it's a data structure....
+ 2
A class is a layer of data structure. Object Oriented Programming is a a way of programming. Class - apple, Oop - orange, two entirely different concepts.. 😨
+ 2
A pointer is a C++ variable that contains the address of another variable in the computer's internal memory. ... For most computers, including Macintoshes and PCs, the smallest addressable piece of memory is a byte. A byte is 8 bits and corresponds to a variable of type char.
What's a Pointer in C++? - dummies
https://www.dummies.com › cpp › whats...
+ 1
c++ actually isnt object oriented. both languages are designed for different purposes. c++ is an old native language without any fancy features for developing directly on hardware. they just dont have heap/stack management or whatever. java is always running on an virtual machine and was designed with convinience and development speed over performance. short anwer: by design and purpose of both languages.
+ 1
javas runtime environment ist managing all memory stuff. c++ doesnt have that, so you need to do it yourself. better answer ^^
+ 1
because java isnt a native language. its running on a virtuall machine, there is no actual hardware you can point to. all memory management is handled by the runtime
+ 1
Java is not a purely object oriented programming language as it supports primitive datatypes.
Every object is pointer to itself that dynamically allocates memory to its class data members, class membered functions .