Is Class a Variable?

P

Penna Elabi

Is class a variable? Can a variable consist of variables?

For example, a vector is a class, so is this vector a variable when it
includes two int variables:

vector < int > exampleVector( 2, 2 );
 
J

Jon Bell

Is class a variable? Can a variable consist of variables?

For example, a vector is a class, so is this vector a variable when it
includes two int variables:

vector < int > exampleVector( 2, 2 );

"vector<int>" is not a variable, any more than "int" is; it is the name of
a specific *type* of variable. "exampleVector" is a variable which
contains two variables that don't have names of their own.

Some programmers say "class" when they really mean "object (or variable)
of that class (type)", which can be confusing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,148
Messages
2,570,838
Members
47,385
Latest member
Joneswilliam01

Latest Threads

Top