473,402 Members | 2,046 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

instance - definition and analysis

13
Hi there,

I am doing a programming project in which there is a written essay/report component along with a coding component.

In my codes, I used instance variables so that I wouldn't keep on recreating new objects. And every time I need to call a Rec object I just use:
Rec* r = Rec::instance();

Rec* Rec::instance()
{
if (!myInstance)
{
myInstance = new Rec();
}

return myInstance;
}

My problem is that I am having trouble putting this all into words savvy enough for the report. I am having trouble explaining exactly what instance objects are and how it is useful in this case, and make it sound clear and understandable at the same time.

I'm wondering if anyone can help me, whether they know any good resources, or if they are good with words.

Thanks a bunch
Mar 31 '07 #1
3 1480
sicarie
4,677 Expert Mod 4TB
Hi there,

I am doing a programming project in which there is a written essay/report component along with a coding component.

In my codes, I used instance variables so that I wouldn't keep on recreating new objects. And every time I need to call a Rec object I just use:
Rec* r = Rec::instance();

Rec* Rec::instance()
{
if (!myInstance)
{
myInstance = new Rec();
}

return myInstance;
}

My problem is that I am having trouble putting this all into words savvy enough for the report. I am having trouble explaining exactly what instance objects are and how it is useful in this case, and make it sound clear and understandable at the same time.

I'm wondering if anyone can help me, whether they know any good resources, or if they are good with words.

Thanks a bunch
It looks like you're using the Singleton design pattern. Does that help, or am I mis-interpreting your code?
Mar 31 '07 #2
ice8595
13
It looks like you're using the Singleton design pattern. Does that help, or am I mis-interpreting your code?
wow...thanks so much

wasn't it silly how I wrote the program without knowing the name of the method i'm using? I took an idea someone suggested to me and just kinda went with it. And I am now stuck on explaining exactly what I did. haha
Mar 31 '07 #3
sicarie
4,677 Expert Mod 4TB
wow...thanks so much

wasn't it silly how I wrote the program without knowing the name of the method i'm using? I took an idea someone suggested to me and just kinda went with it. And I am now stuck on explaining exactly what I did. haha
Yeah, I had no idea what they were until I took a grad-level Java programming course. You learn something new every day. They actually help quite a bit, once you start looking at them. )
Mar 31 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: David MacQuigg | last post by:
I am writing a chapter for teaching OOP in Python. This chapter is intended as a brief introduction to replace the more complete discussion in Learning Python, 2nd ed, pp. 295-390. I need to...
44
by: Steven T. Hatton | last post by:
This may seem like such a simple question, I should be embarrassed to ask it. The FAQ says an object is "A region of storage with associated semantics." OK, what exactly is meant by "associated...
19
by: J. J. Farrell | last post by:
After many years of dealing with definition and linkage issues in ways that I know to be safe, I've decided it's time to try to understand this area properly. Consider a header file with the file...
3
by: wolfgang.lipp | last post by:
some time after posting my `Linkdict recipe`__ to aspn__ -- basically, a dictionary with run-time delegational lookup, but this is not important here -- i thought gee that would be fun to make...
14
by: key9 | last post by:
Hi All On coding , I think I need some basic help about how to write member function . I've readed the FAQ, but I am still confuse about it when coding(reference / pointer /instance) , so I...
11
by: Joe | last post by:
I know I've seen this before but I can't remember how to serialize a class with it's definition. For example I want each class to serialize not only with it's fields' values but the fields data...
12
by: titan nyquist | last post by:
I have a class with data and methods that use it. Everything is contained perfectly THE PROBLEM: A separate thread has to call a method in the current instantiation of this class. There is...
4
by: camarkco | last post by:
Why does C# go out of it's way to prevent this? Mark
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.