Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 26th, 2008, 05:37 AM
Authorized User
 
Join Date: Apr 2007
Location: Delhi, Delhi, India.
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default Difference between Instance and Object in #

Halo,

Q. No- 1 What is the difference between Instance and Object in C#
and
Q. No- 2
class A
{
public virtual void get()
{
Console.WriteLine("Hello");
}
}
class B:A
{
public override void get()
{
Console.WriteLine("Fine");
}
}



Ist Method
A e = new B();
e.get();

IInd Method
B e = new B();
e.get();

Difference between in Ist Method and IInd Method of intializing the object of the the Class A

Reply With Quote
  #2 (permalink)  
Old August 26th, 2008, 05:41 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hampshire, United Kingdom.
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

Answer: Do your own homework.

Rob
http://cantgrokwontgrok.blogspot.com
Reply With Quote
  #3 (permalink)  
Old August 26th, 2008, 05:49 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Te-he :)

/- Sam Judson : Wrox Technical Editor -/
Reply With Quote
  #4 (permalink)  
Old August 26th, 2008, 07:15 AM
Authorized User
 
Join Date: Apr 2007
Location: Delhi, Delhi, India.
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm not getting the right answer. If you can suggest me the way tht's very better.....................

Reply With Quote
  #5 (permalink)  
Old August 26th, 2008, 07:26 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hampshire, United Kingdom.
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

Well, what ever course you are doing MUST have covered object instantiation, inheritance and the like..

And even if it hasn't, type the code, what does the code tell you?

Rob
http://cantgrokwontgrok.blogspot.com
Reply With Quote
  #6 (permalink)  
Old August 26th, 2008, 08:15 AM
Authorized User
 
Join Date: Apr 2007
Location: Delhi, Delhi, India.
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default

<b>(Differnce between Instance and Object)</b> I knw this is very basic question. Plz visit this link http://www.codeproject.com/script/Fo...49&msg=2694434<b>.NET- India</b> is my name(in the community) then u can understand why i m so confused it has taken a long discussion but still not very clear and understandable......

Reply With Quote
  #7 (permalink)  
Old August 26th, 2008, 08:26 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

You don't need to ponder this one very long - all you need to do is type the code up and compile it - it will give you the answer in front of you.

/- Sam Judson : Wrox Technical Editor -/
Reply With Quote
  #8 (permalink)  
Old August 26th, 2008, 08:42 AM
Authorized User
 
Join Date: Apr 2007
Location: Delhi, Delhi, India.
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes i got my second question's answer by implementing a simple question

the question was Diff between
A e=new B();
e.get();

B e=new B();
e.get();

But still a bit confused about "diff between instance and object"

Reply With Quote
  #9 (permalink)  
Old August 26th, 2008, 08:50 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hampshire, United Kingdom.
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

So what are you saying? You don't know what the words "object" and "instance" mean?!

Rob
http://cantgrokwontgrok.blogspot.com
Reply With Quote
  #10 (permalink)  
Old August 26th, 2008, 09:22 AM
Authorized User
 
Join Date: Nov 2006
Location: Valparaiso, IN, USA.
Posts: 93
Thanks: 0
Thanked 1 Time in 1 Post
Default

I don't like these kinds of ambiguities, especially in software development. In object oriented programming, an object is an instance of a class period! The object doesn't exist until the class is instantiated and memory has been allocated (part of the instantiation process).


What you don't know can hurt you!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Object Reference not set to an instance of object srinivas_chakka ASP.NET 1.0 and 1.1 Professional 0 February 8th, 2006 11:56 AM
Object Reference is Not Set to an Instance of an O blackinwhite General .NET 4 February 1st, 2005 05:42 AM
Object reference not set to an instance... steelman BOOK: ASP.NET Website Programming Problem-Design-Solution 6 May 7th, 2004 02:03 AM
How do i create an instance of an active x object RDosch Classic ASP Basics 1 July 9th, 2003 06:11 AM



All times are GMT -4. The time now is 01:21 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.