answersLogoWhite

0

An array stores a list of values, usually of the same type. Values are distinguished by a subscript.

A class usually doesn't store objects, but it defines a template for objects. Objects based on this class store data, which can be of different types, and are distinguished by name (similar to variables). A class thus defines a new, composite, data type (so does an array, but in a more limited way).

Besides, a class can also define functions (usually called "methods"), specifically for objects of that type.

Usage example: If you want to sort 100 numbers, or do some other work with them, you might store them in an array of numbers (integers, or floating-point numbers, depending on your needs).

If, on the other hand, you want to store information about a person, you might create a class, where you define that a "person" includes information about a first name, last name, birthdate, etc.

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

What is the difference between numeric array and associative array?

Numeric array has numbers(+integers) that represent the values Associative array has strings that represent the values


What is the difference between array and string of array?

When we declare an array of characters it has to be terminated by the NULL , but termination by NULL in case of string is automatic.


Difference between vector and array list?

Vectors are thread safe but array lists are not. Hence array lists are faster than Vectors.


What is the minimum absolute difference between any two elements in a given array?

The minimum absolute difference between any two elements in a given array is the smallest positive number that can be obtained by subtracting one element from another in the array.


What's the difference between the Class 365 and Class 465 466?

The difference between the Class 365 and Class 465, 466 is basically the cost.


Difference between exclusive or inclusive class intervals?

difference between inclusive and exclusive class interval


What is difference between first class and second class on train trips?

What is the difference between buying a 1st class and a 2nd class ticket on the train in England?


What is the difference between a Magician and a Chorus Line?

A Magician has a cunning array of stunts ...........................................................................


What is Difference between programmable logic array and programmable array logic?

Using and gate - pla is programmable while pal is fixed


What is the price difference between first class and economy class tickets for this flight?

The price difference between first class and economy class tickets for this flight is 500.


What is the difference between a class What is the difference between a class III and class IV hitch and?

class III rated for up to 5,000lbs, class IV is rated for up to 10,000lbs towing capacity


Why is an array called a derived data type?

An array is not a derived data type at all. In order to be derived there has to be a base class and an array has no base class. Here is the basic declaration of the std::array template class from the <array> header file: template<class _Ty, size_t _Size> class array { // fixed size array of values // ... }; A vector, on the other hand, is derived (from the <vector> header file): template<class _Ty, class _Alloc = allocator<_Ty>> class vector : public _Vector_alloc<!is_empty<_Alloc>::value, _Vec_base_types<_Ty, _Alloc>> { // varying size array of values // ... };