Are primitives objects?

From: Fred (
Date: 01/09/04

Date: Fri, 09 Jan 2004 07:09:34 GMT

Are primitives objects?

int i = 3;

doesn't compile. Get an error message
"int can't be dereferenced"

But yet the docs for class Object say:
Class Object is the root of the class hierarchy. Every class has Object as
a superclass.

Relevant Pages

  • Why is my const pointer not behaving?
    ... Object ** obj; ... My query is if I changed the "const char *" to simply int as the ...
  • Re: what is meant by ?
    ... the class in a context where you would normally use an int and the operator ... Conversion operators can be used quite generally. ... if you make a mistake and use a class object some place where you shouldn't, the conversion operator may allow the code to compile and thereby stop you from discovering the mistake. ...
  • Explicitly calling the constructor
    ... reserve memory for a class object, and then trying to call the object's ... class CTestClass ... int main ...
  • Re: Opinion on coding style.
    ... to use int with the same syntax you would use if you were constructing ... an class object using a specific constructor, to me seem like poor style. ... The above is the same syntax you might use if you were calling the DWORD ...
  • Re: Are primitives objects?
    ... No, primitives are not objects. ... Every primitive type has it's own corresponding object type. ... int -> Integer, double -> Double, etc. ... > Class Object is the root of the class hierarchy. ...