that s what i learned since i saw in many examles programmers using a function main whithout any class
asking for any explication please :confused:

Not everything is an object. Only those things declared with 'class' or 'struct', or that are of a type that was declared with 'class' or 'struct'.

// NOT a class:
int DoSomething()
{
}

// IS a class:
class AClassThatDoesSomething
{
    int DoSomething();
};

int main()  // not a class
{
    DoSometing();  // not a class

    AClassThatDoesSomething ctds;
    ctds.DoSomething();  // IS a class member
}

that s what i learned since i saw in many examles programmers using a function main whithout any class
asking for any explication please :confused:

Object is a variable of type class.
Class is a type. Like structures and unions, class is a user defined data type.
Objects are variables of type Class. You can create n-number of objets(variables) of type class.
:cool:

An object is not just a C++ thing associated with a class.

object
region of data storage in the execution environment, the contents of which can represent values

So ints and pointers and arrays are objects too.

Well, you can call an 'int' an object, but in VC++ you can't say:

class Foo : public int
{
    Foo() {}
    virtual ~Foo() {}
};

So, it is not an object in the sense that you can't override it, inherit from it, make yourself a friend to it, and so on.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.