help for the following statement

Status
Not open for further replies.

nitinm

Broken In
can please any one tell me what is the meaning of the below statement

1) Account acc;

2) Account acc = new Savings Account;

can the second statement be applied for abstract classes
as i have heared abstract classes cannot be instantiated but we can create objects:confused: :confused: :confused:
 

ray|raven

Think Zen.
The first statement creates an object of the class Account.
The second one instantiates it;although i dont think the syntax is right.
Abstract classes can have objects created and not instantiated.
The second statement cant be used for abstract classes.
 

Pathik

Google Bot
^^ Exactly.
can please any one tell me what is the meaning of the below statement

1) Account acc;

2) Account acc = new Savings Account;

can the second statement be applied for abstract classes
as i have heared abstract classes cannot be instantiated but we can create objects:confused: :confused: :confused:

BTW Creating an object is the same as instantiating a class.
and yea the 2nd statement should be
Account acc= new Account;
If I am not missing anything.
 
Status
Not open for further replies.
Top Bottom