Sphere: Related Content
/*
* In one of the Interviews, I had been asked what is the size of the Virtual and Non-Virtual Class. Here is program to compute
*/
#include <iostream>
using namespace std;
class Virtual // sizeof(Virtual) == 8
{
private:
int mv;
public:
Virtual() { mv = 0; }
virtual ~Virtual() {}
virtual int foo() const { return (mv); }
};
class NonVirtual // sizeof(NonVirtual) == 4
{
private:
int mnv;
public:
NonVirtual() { mnv = 0 ; }
~NonVirtual() {}
int foo() const { return (mnv); }
};
int main()
{
Virtual vClass;
NonVirtual nvClass;
cout << "Sizeof of virtual class" << sizeof(vClass) << endl;
cout << "Sizeof of Nonvirtual class" << sizeof(nvClass) << endl;
return 0;
}
Judge Rejects ‘Unprecedented’ Indictment Amid Trump’s D.C. Clampdown
-
The federal magistrate judge, Zia M. Faruqui, accused prosecutors of
relying on a “facially invalid” indictment to charge a man with felony gun
possession.
35 minutes ago
No comments:
Post a Comment