Sunteți pe pagina 1din 3

#include<iostream.

h>

Using name space std

Union num

Int value I;

Float value f;

Double value d;

Char value c;

//optional union keyword;

//value1=100;

Test value={100};

Cout<<\ninteger=<<Test val.value1<<endl;

Test val.value F=2.123;

Cout<<Float=<<Test val.valueF<<endl;

Cout<<uninitialized double=<<Test val.valueD<<endl;

Cout<<some rubbish???<<endl;

Test val.valueC=u;

Cout<<CHARACTER=<<Test val.value<<endl;

#include<iostream.h>

#include<stdlib.h>

Vehicle parts()

Int wheels;

Int seats;
Vehicle parts()

Cout<<\n vehicle parts-default constructer;

Vehicle parts(int wheels,int seats)

This->wheels=wheels;This->seats=seats;

Cout<<\nvehicle parts-parameterized constructer;

#include<iostream.h>

Union my types-t

Void main()

Inti;

Float f;

Char c;

My types;

Int main()

My types.c=H;

My types.i=15;

Cout<<size of (my types)<<endl;

My types(PAUSE);

Return 0;

S-ar putea să vă placă și