LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-03-2002, 04:36 PM   #1
mikeshn
Member
 
Registered: Feb 2002
Posts: 586

Rep: Reputation: 30
Instance of a class?


Please correct me if I'm wrong. The instance if a class is a copy of the class?

Thanks
 
Old 06-03-2002, 04:48 PM   #2
dorward
Member
 
Registered: Sep 2001
Distribution: Gentoo
Posts: 760

Rep: Reputation: 31
Not really. Let's use a bus as an example.

The "bus" class contains all the information you need to build a bus.
The "number 47" instance of "bus" is one particular bus.
 
Old 06-03-2002, 10:17 PM   #3
gui10
Member
 
Registered: Mar 2001
Distribution: enigma, slack8
Posts: 677

Rep: Reputation: 30
a class is something like a blueprint of what properties an object has and what it can do. but it's only a blueprint. doesn't really exist.

instantiating a class = creating an object.
creating an object according to a class implies that this object exists in "reality" now.

taking the example of doward:
a simplistic blueprint/class of a bus
Properties: 4 wheels, a body and a wheel.
Functions: move forwards, move backwards
our company has created our 47th bus of the day. ie., in object oriented terminology, we have made our 47th instance of the class "bus" today.

Last edited by gui10; 06-03-2002 at 10:20 PM.
 
Old 06-03-2002, 10:38 PM   #4
cludwin
Member
 
Registered: Feb 2002
Distribution: Slack
Posts: 50

Rep: Reputation: 16
An instance of a class is just that, an instance of that class that resides in memory. You can have multiple instances in memory, each having different values for it?s class fields. For example people often refer to an object (or class) that has been instantiated (or literally created in memory) as a class instance.

Hope this helps,
cludwin
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Implementing a vector class from a list class purefan Programming 9 04-14-2005 10:48 PM
PHP: how to use a method from a class in the same class ldp Programming 5 09-17-2004 09:52 AM
BlackBox.class & VerifierBug.class virus ??? dalek Linux - Security 4 02-29-2004 08:55 AM
Inheriting class members (Qt C++, QApplication class) jtshaw Programming 2 01-15-2004 11:52 AM
c++ : regarding (inheritence)base class and derived class edreddy Programming 6 07-31-2002 06:33 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration