I've got a base class and 2 derived class. One derived class which gets base class as virtual and the other one as non virtual. I've given below my codin.

// This program uses virtual base classes.
#include <iostream>
using namespace std;
class base {
int i;
// derived inherits base as not virtual
class derived : public base {
int x;
// derived1 inherits base as virtual.
class derived1 : virtual public base {
int j;
int main()
base b;
cout<<endl<<sizeof(b)<<" ";
derived obn;
cout<<sizeof(obn)<<" ";
derived1 ob1;

return 0;

After running the program i recieve the below output

4 8 12

"Why the virtual derived class getting 12 bytes? "