What is a Wrapper class? - C++

What is a Wrapper class?

- Wrapper classes wrap primitive values in a class and offers utility to access them through objects.
- Some of the primitive wrapper data types are :
Byte, short, int, long, float, double, char, Boolean.
- Example :
Create a class name VectorAdd to populate it with integer values using the add(int, object) method.
public class VectorAdd
{
   public static void main(String argv[])
   {
       Vector v = new Vector();
       v.add(0,new Integer(10));
       v.add(1,new Integer(20));
       v.add(2,new Integer(30));
       for(int i=0; i < v.size();i ++)
       {
          Integer iw =(Integer) v.get(i);
          System.out.println(iw);
       }
   }
}

What is a Wrapper class?

Wrapper classes are classes that allow primitive types to be accessed as objects.
What do you mean by stack unwinding? - C++
What do you mean by stack unwinding? - When an exception is thrown, C++ calls destructors to destroy all the objects....
What is the use of ‘using’ declaration?
What is the use of ‘using’ declaration? - In using-declaration, we have using keyword followed by a fully qualified name...
What is the difference between Mutex and Binary semaphore? - C++
Difference between Mutex and Binary semaphore - Semaphore synchronizes processes where as mutex synchronizes threads...
Post your comment