codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Question in C++  pandu345 at 18:07 on Thursday, August 10, 2006
 

Hi All,
I was asked this question by an interview in Amazon.I am not sure if the one I know is the righht answer.You have the following code.

code:// C is a class
C c1 = new C;
C c2 = c1;


Can you tell me what happens when this code is executed,in terms of memory and all.I spoke about copy constructor and screwed myself.

Thanks,
pandu

  Re: Question in C++  alim.mtech at 10:20 on Monday, August 21, 2006
 

C c1=new call();
C c2;
c1--> creates memory for the object c1;
U need to clear the garbage when ever its usage over.
c2--> Just it is a reference to the class.
no need for clearing garbage collection.








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Question in ASP?
•  Desperately need help
•  MDI form open size and location
•  Connection To Database
•  Re: Question in C++
•  Re: Resizing Table Columns
•  Newbie - Form
•  problem in servlet
•  Re: installing DB_File on Perl Package Manager(PPM)


Recent Articles
What is a pointer in C?
Multiple submit buttons with form validation
Understanding Hibernate ORM for Java/J2EE
HTTP screen-scraping and caching
a javascript calculator
A simple way to JTable
Java Native Interface (JNI)
Parsing Dynamic Layouts
MagicGrid
Caching With ASP.Net


© Copyright codetoad.com 2001-2006