![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Feb 2006
Location: India
Posts: 25
Rep Power: 0
![]() |
Size of inherited class!
#include<iostream>
using namespace std;
class X
{
int x;
public:
int y;
protected:
int z;
};
class Y : public X
{
int a;
public:
int b;
protected:
int c;
};
int main()
{
cout<<sizeof(Y);
return 0;
}According the output (24 on my machine) , even the variable x which was private in class X is being considered as a part of class Y? Please explain! |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| singly-linked list templaste class in C++ w/ example driver | bl00dninja | Show Off Your Open Source Projects | 0 | Sep 11th, 2006 2:05 AM |
| Wierd compile Error. Need help please. | Keiyentai | Java | 7 | Aug 19th, 2006 2:35 AM |
| What is: "Oriented programming (OO)?" | BrinyCode | C++ | 12 | Nov 22nd, 2005 8:40 AM |
| User Input for Number Format | ericelysia1 | Java | 0 | Jul 21st, 2005 4:41 PM |
| MFC/OpenGL: problem with 'Document' class | brenda | C++ | 11 | May 23rd, 2005 9:10 PM |