|
-
September 25th, 2008, 12:07 PM
#1
Why do we dont need to mention the sizeof the class when using 'new' operator
Hi, Can anyone give me detailed information why we don't need to pass size when using new operator
for example
class A
{
int x;
public:
A()
{
x = 20;
}
}
int main()
{
A *a1 = new A(); // here how does the compiler know how much memory to allocated. Is it the comipler speciality or the new operator ?
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|