Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Closed Thread
 
LinkBack Thread Tools Display Modes
Old 05-03-2008, 05:19 PM   #1 (permalink)
Right Off the Assembly Line
 
Join Date: Nov 2007
Posts: 28
Question help for the following statement


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
nitinm is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 05-03-2008, 05:23 PM   #2 (permalink)
Think Zen.
 
ray|raven's Avatar
 
Join Date: Dec 2005
Posts: 1,498
Default Re: help for the following statement

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.
__________________
Do what you will; but not because you must. -- Zen Quote
ray|raven is offline  
Old 05-03-2008, 08:03 PM   #3 (permalink)
Google Bot
 
Pathik's Avatar
 
Join Date: Aug 2005
Posts: 9,772
Default Re: help for the following statement

^^ Exactly.
Quote:
Originally Posted by nitinm View Post
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
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.
__________________
My new blog: www.pathikshah.com
Pathik is offline  
Old 05-03-2008, 08:27 PM   #4 (permalink)
Mad and Furious
 
redhat's Avatar
 
Join Date: May 2006
Location: Visual Basic 6.0
Posts: 453
Default Re: help for the following statement

^^+1
Wrong Syntax in 2nd statement
It must be "Account acc= new Account;"
redhat is offline  
Old 05-03-2008, 08:42 PM   #5 (permalink)
C# Be Sharp !
 
Zeeshan Quireshi's Avatar
 
Join Date: Jun 2006
Location: Toronto
Posts: 1,805
Default Re: help for the following statement

Wrong !

acc = new Account();

as acc has already been declared n we need to use the brackets to call the contructor
__________________
There are 10 types of people in the world: those who understand binary and those who do not.
Zeeshan Quireshi is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Google's Official Statement on the Microsoft Bid for Yahoo soumya Technology News 2 05-02-2008 12:39 PM
':' turning into label statement redhat Programming 13 04-02-2008 12:25 AM
?using single printf statement to print 2 answers? slugger Programming 8 01-02-2008 03:02 PM
What is a null statement in C language? fun2sh Programming 11 13-07-2007 07:36 PM
Clarification of a Problem Statement... Important. Thor QnA (read only) 1 28-09-2006 07:44 PM

 
Latest Threads
- by Charan
- by Sarath
- by clmlbx

Advertisement




All times are GMT +5.5. The time now is 12:53 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2