Sponsored Content
Full Discussion: C++ singleton
Top Forums Programming C++ singleton Post 302709525 by JohnGraham on Wednesday 3rd of October 2012 10:41:04 AM
Old 10-03-2012
The typical schemis is to make the constructor private, and provide a public function that sees if an instance has already been instantiated, constructs it if it's not been, and then returns it. This way, no other class can even attempt to instantiate your class a second time, since the constructor is private. Always better to find out problems at compile-time rather than run-time (IMHO).
 

3 More Discussions You Might Find Interesting

1. Programming

What is singleton class ?

hello members, What is singleton class in c++ and in which case we will go with singleton class. Thanks & Regards Rajkumar_g (2 Replies)
Discussion started by: rajkumar_g
2 Replies

2. Programming

C++ abstract (singleton) factory implementation...

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

3. UNIX for Beginners Questions & Answers

AIX errpt : ( E7A89C7D Local adapter disabled after unstable singleton for long time )

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
REFLECTIONPROPERTY(3)							 1						     REFLECTIONPROPERTY(3)

The ReflectionProperty class

INTRODUCTION
The ReflectionProperty class reports information about classes properties. CLASS SYNOPSIS
ReflectionProperty ReflectionPropertyReflector Constants o const integer$ReflectionProperty::IS_STATIC1 o const integer$ReflectionProperty::IS_PUBLIC256 o const integer$ReflectionProperty::IS_PROTECTED512 o const integer$ReflectionProperty::IS_PRIVATE1024 Properties o public$name o public$class Methods o finalprivate void ReflectionProperty::__clone (void ) o public ReflectionProperty::__construct (mixed $class, string $name) o publicstatic string ReflectionProperty::export (mixed $class, string $name, [bool $return]) o public ReflectionClass ReflectionProperty::getDeclaringClass (void ) o public string ReflectionProperty::getDocComment (void ) o public int ReflectionProperty::getModifiers (void ) o public string ReflectionProperty::getName (void ) o public mixed ReflectionProperty::getValue ([object $object]) o public bool ReflectionProperty::isDefault (void ) o public bool ReflectionProperty::isPrivate (void ) o public bool ReflectionProperty::isProtected (void ) o public bool ReflectionProperty::isPublic (void ) o public bool ReflectionProperty::isStatic (void ) o public void ReflectionProperty::setAccessible (bool $accessible) o public void ReflectionProperty::setValue (object $object, mixed $value) o public string ReflectionProperty::__toString (void ) PROPERTIES
o $name - Name of the property. Read-only, throws ReflectionException in attempt to write. o $class - Name of the class where the property is defined. Read-only, throws ReflectionException in attempt to write. PREDEFINED CONSTANTS
REFLECTIONPROPERTY MODIFIERS
o ReflectionProperty::IS_STATIC - Indicates static properties. o ReflectionProperty::IS_PUBLIC - Indicates public properties. o ReflectionProperty::IS_PROTECTED - Indicates protected properties. o ReflectionProperty::IS_PRIVATE - Indicates private properties. PHP Documentation Group REFLECTIONPROPERTY(3)
All times are GMT -4. The time now is 08:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy