11-10-2010
Hi ,
A singleton class means you instantiate only one object of that class at a time. For example if you want to make an application in such a way that only one instance of that exe should execute at a time, you can make that class a singleton class. To make a class a singleton class, you have to make its contrustors private and write a static method for creating an object.
10 More Discussions You Might Find Interesting
1. UNIX Desktop Questions & Answers
Hi..!!!You have a very nice web-site! Good work!I am also webmaster and I like this one!Thank you! (1 Reply)
Discussion started by: Hardan
1 Replies
2. UNIX for Dummies Questions & Answers
im just trying to have some fun and kill some time writing a c++ program that has a person type in a car make and model then gives them a year and a price. or something like that. i always have problems getting it goin but once the ball is rolling im usually pretty good. anyone wanna help me out? ... (1 Reply)
Discussion started by: rickym2626
1 Replies
3. Programming
Hi, i have a question about C++. Is it possible to declare a class with a member ot the same class? For example, a linked list or i want to convert this C code to C++ class (Elemento)
typedef struct elemento
{
char name;
char value;
List<struct elemento> ltElementos;
... (7 Replies)
Discussion started by: pogdorica
7 Replies
4. Programming
Hi,
I believe the next code is wrong:
class Egg {
Egg e;
int i;
Egg(int ii=0) : i(ii) {}
};
because you would end up with an endless definition (memory allocation) of Egg objects, thus int i.
Ok, so God Eckel proposes for a singleton:
class Egg {
static Egg e;
int... (5 Replies)
Discussion started by: xavipoes
5 Replies
5. Programming
I want to create an abstract factory template which will allow me to pass in an "ID" for a subclass and return the singleton instance of that class stored in the factory. It'd be easy to adapt for "multi-ton", but for its present use this isn't necessary.
The requirements are:
- I don't want... (2 Replies)
Discussion started by: DreamWarrior
2 Replies
6. Programming
How to write a class that can only be instancialized once?
what about my implementation below?
#include<iostream>
#include<stdexcept>
using namespace std;
class Singleton
{
public:
int b;
Singleton();
private:
static int num;
};
int Singleton::num = 1; (10 Replies)
Discussion started by: vistastar
10 Replies
7. UNIX for Advanced & Expert Users
Hi all!
I am trying to register a device in an existing device class, but I am
having trouble getting the pointer to an existing class.
I can create a class in a module, get the pointer to it and then use
it to register the device with:
*cl = class_create(THIS_MODULE, className);... (0 Replies)
Discussion started by: hdaniel@ualg.pt
0 Replies
8. Programming
I have the two class definition as follows.
class A { public: int a; };
class B : virtual public A{ };
The size of class A is shown as 4, and size of class B is shown as 16. Why is this effect ?. (2 Replies)
Discussion started by: techmonk
2 Replies
9. Programming
Hello All,
I am a learner in C++. I was testing my inheritance knowledge with following piece of code.
#include <iostream>
using namespace std;
class base
{
public :
void display()
{
cout << "In base display()" << endl;
}
void display(int k)
{... (2 Replies)
Discussion started by: anand.shah
2 Replies
10. UNIX for Beginners Questions & Answers
Medel : 9117-MMC
OS: AIX 6.1
Patch level : 6100-07-04-1216
Hacmp version : HACMP v 6.1.0.8
Oracle : 11.2.0.3 RAC
Node : 2 node
Dear, my one node server has been restarted early this morning, So, i tried to start HA and Oracle database.
after that, the follow error appears at the node... (1 Reply)
Discussion started by: tomato00
1 Replies
ecppc(1) Tntnet users guide ecppc(1)
NAME
ecppc - compiler for ecpp
SYNOPSIS
ecppc [-bhszvtM] [-s-] [-o filename] [-n name] [-m mimetype] [--mimetypes filename] [-I dir] [-l log-category] filename
ecppc -bb filename...
DESCRIPTION
Ecppc is the compiler for the ecpp-language. Ecpp is a template-language, which lets the user embed C++-code into HTML for use in tntnet
(8). Ecppc generates a C++-class from a ecpp-template. It can also compile binary data into a C++-class, which makes it possible to inte-
grate them in a tntnet-application.
OPTIONS
-b This enables binary-mode. Ecppc does not look for ecpp-tags, but creates a class, which just copies the data
-bb This enables multi-binary-mode. Every binary-file has some overhead, when packed into a tntnet-application. This overhead can be
quite significant, when binary-files are small, like small icons in a web application. To reduce this overhead, multiple binaries
can be packed into a single class, which removes the per-binary overhead completely.
When the component is called, it uses the path-info-parameter (request.getPathInfo()) from the request, to decide, which binary to
send. If no filename matches the path-info, processing is declined. The binaries need not be of same mime-type, since the mime-
type is looked automatically from the mime-database by file-extension of the source-file.
-I dir Search include-files in directory. This option can be passed multiple times. All specified directories are searched in turn for
include-files.
-l log-category
Set log category. Default is "component.componentname".
-L Disable generation of #line-directives
-m mimetype
Set mimetype of output. This is the mimetype, sent by the component to the browser in the Content-Type-header. Without this param-
eter the mimetype is looked up from the mime-database of your system using the file-extension of the source-file.
--mimetypes file
Read mimetypes from file (default: /etc/mime.types).
-M This disables normal processing and prints just the ecpp-dependencies from this component. The output can be included into a Make-
file. Ecpp-dependencies are introduces by the <%include>-tag.
-n name
Set the name of the component. Normally this is derived from the source-file-name by removing the path and .ecpp-extension.
-o filename
Write the generated file to the specified file instead of deriving the filename from the source-file-name. The outputfilename is
normally the source-file where the extension is replaced by .cpp.
-p Keep path name when deriving name of component from input file name.
-s Generate singleton. Normally ecppc decides automatically, if the template is suitable for a singleton. This option force ecppc to
generate a singleton.
-s- Do not generate a singleton.
-v Enable verbose mode. This prints additional information about the processing on the standard-output.
-z Compress the data in the component. Compressed data is automatically decopressed on first use. This reduces the code-size, but
slightly slows down the first call of the component.
AUTHOR
This manual page was written by Tommi Makitalo <tommi@tntnet.org>.
SEE ALSO
tntnet(1), ecpp(7), ecppl(1), ecppll(1).
Tntnet 2006-07-23 ecppc(1)