/ Forside / Teknologi / Udvikling / Java / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
Java
#NavnPoint
molokyle 3688
Klaudi 855
strarup 740
Forvirret 660
gøgeungen 500
Teil 373
Stouenberg 360
vnc 360
pmbruun 341
10  mccracken 320
Java mer OO enn C++?
Fra : daxi jumbo


Dato : 19-05-02 18:36

Ja, jeg vet at dere forstår norsk :) men jeg pleier å poste innlegget på en
engelsk newskanal først, og da er det ikke alltid jeg orker å oversette
tilbake til norsk.. håper det er greit.

I am having a discussion with some people that claims the following:

Java is more "fully" an object oriented language than C++ is because C++ has
pointers.
C++ pointers breaks encapsulation of private data. The argument for this is
that a pointer enables you to set the value into the reference without using
public methods of that data. As in:

class C {
private:
int x;
public:
C() { x = 3; }
int *getX() { return &x; }
};

void main() {
C c;
*c.getX() = 4;
}

But isn't this statment (*c.getX() = 4) the same as implicitly calling the
overloaded operator for int? So it could be said that this statement uses
one of int's accessor methods?

final question. Is Java a more Object Oriented language than C++ is?
What is the definition of an OO language?

thanks.



 
 
Søg
Reklame
Statistik
Spørgsmål : 177501
Tips : 31968
Nyheder : 719565
Indlæg : 6408522
Brugere : 218887

Månedens bedste
Årets bedste
Sidste års bedste