codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#include<stdio.h> class Base{ public: double b1; }; class Derived : public Base{ public: int d1; Base d2; }; int main(){ Derived* D; Base* B1 = new Base(); Base* B2= new Derived(); // B1 and B2 point to objects of different sizes printf("%d\n", sizeof(*D)); printf("%d\n", sizeof(*B1)); printf("%d", sizeof(*B2)); return 0; }
Private
[
?
]
Run code
Submit