Search Results

Search found 45436 results on 1818 pages for 'singleton class'.

Page 63/1818 | < Previous Page | 59 60 61 62 63 64 65 66 67 68 69 70  | Next Page >

  • package private static member class vs. package private class

    - by Helper Method
    I was writing two implementations of a linked list for an assignment, a doubly linked list and a circular doubly linked list. Now as the class representing a Link within the linked list is the same in both implementations, I want to use it in both. Now I wonder which approach would be better: Implement the Link class as a package private static member class in the first implementation and then use this class in the second implementation or make the Link class a package private class.

    Read the article

  • What happens when I instantiate class in Python?

    - by Konstantin
    Could you clarify some ideas behind Python classes and class instances? Consider this: class A(): name = 'A' a = A() a.name = 'B' # point 1 (instance of class A is used here) print a.name print A.name prints: B A if instead in point 1 I use class name, output is different: A.name = 'B' # point 1 (updated, class A itself is used here) prints: B B Even if classes in Python were some kind of prototype for class instances, I'd expect already created instances to remain intact, i.e. output like this: A B Can you explain what is actually going on?

    Read the article

  • how to make objects globally accessible?

    - by fayer
    i have this code: class IC_Core { /** * Database * @var IC_Database */ public static $db = NULL; /** * Core * @var IC_Core */ protected static $_instance = NULL; private function __construct() { } public static function getInstance() { if ( ! is_object(self::$_instance)) { self::$_instance = new self(); self::initialize(self::$_instance); } return self::$_instance; } private static function initialize(IC_Core $IC_Core) { self::$db = new IC_Database($IC_Core); } } but when i wanna access IC_Database with: $IC = IC_Core::getInstance(); $IC->db->add() // it says that its not an object. i think the problem lies in self::$db = new IC_Database($IC_Core); but i dont know how to make it work. could someone give me a hand=) thanks!

    Read the article

  • C++ class derivation and superconstructor confusion

    - by LukeN
    Hey, in a tutorial C++ code, I found this particular piece of confusion: PlasmaTutorial1::PlasmaTutorial1(QObject *parent, const QVariantList &args) : Plasma::Applet(parent, args), // <- Okay, Plasma = namespace, Applet = class m_svg(this), // <- A member function of class "Applet"? m_icon("document") // <- ditto? { m_svg.setImagePath("widgets/background"); // this will get us the standard applet background, for free! setBackgroundHints(DefaultBackground); resize(200, 200); } I'm not new to object oriented programming, so class derivation and super-classes are nothing complicated, but this syntax here got me confused. The header file defines the class like this: class PlasmaTutorial1 : public Plasma::Applet { Similar to above, namespace Plasma and class Applet. But what's the public doing there? I fear that I already know the concept but don't grasp the C++ syntax/way of doing it. In this question I picked up that these are called "superconstructors", at least that's what stuck in my memory, but I don't get this to the full extend. If we glance back at the first snippet, we see Constructor::Class(...) : NS::SuperClass(...), all fine 'till here. But what are m_svg(this), m_icon("document") doing there? Is this some kind of method to make these particular functions known to the derivated class? Is this part of C++ basics or more immediate? While I'm not completly lost in C++, I feel much more at home in C :) Most of the OOP I have done so far was done in D, Ruby or Python. For example in D I would just define class MyClass : MySuperClass, override what I needed to and call the super class' constructor if I'd need to.

    Read the article

  • how to make application singleton.

    - by Mohsan
    hi. i want to make sure that only one instance of application run... i added the mutex check but it causes problem in 64 bit system. the second way is to search process table.. This check can be easily defeated by renaming application. please tell me how to make sure that only one instance of application run.

    Read the article

  • How does one refer to the game1 class's variables in XNA

    - by user1149068
    I try to refer to an array in the Game1 class by creating an object of the Game1 class with its definition Game1 gameObject; , its declaration gameObject = new Game1(); in the constructor, and its usage gameObject.tileArray[xInt, yInt].treed = true;. The game1 class itself remains unchanged in its class code other than some methods and variables. When I try to use this code in the TreeRegion class it gives me "Object reference not set to an instance of an object," leading me to believe that the game1 class is null somehow. How might one change the class or object in order to refer to game1's variables? Mind you I am self-taught and still rather new to C#. The class that refers to game1: http://pastebin.com/0chEcKfq Game1 itself http://pastebin.com/zLDVzCca

    Read the article

  • Getting the type of a parametrized class parameter?

    - by GuidoMB
    I have the following class public class MyClass<T> { public Class<T> getDomainClass() { GET THE CLASS OF T } } I've googled this problem and all the answers I could find told me to use getGenericSuperClass(), but the problem of this method is that I must have a second class that extends MyClass and I don't want to do this. What I need is to get the parametrized type of a concrete class?

    Read the article

  • Do private classes need to be accessed by properties?

    - by Andy
    I am using an instance of a private class as the state object supplied to a stream.BeginRead operation. (The class is private to my main stream reading/writing class.) public class MainClass { // ... private class ResponseState { public IResponse response; public Stream stream; public byte[] buffer = new byte[1024]; } } Access to the class is via the fields directly. Should I really be providing access to the class via properties in this case, even though it is only to be used for holding state? Interested to know what others do.

    Read the article

  • Does this singleton pattern make sense?

    - by dontWatchMyProfile
    @implementation MySingletonClass static MySingletonClass *sharedInstance = nil; + (MySingletonClass*)sharedInstance { @synchronized(self) { if (sharedInstance == nil) { sharedInstance = [[self alloc] init]; } } return sharedInstance; } + (id)alloc { @synchronized(self) { if (sharedInstance == nil) { sharedInstance = [super alloc]; return sharedInstance; } } return nil; } + (id)allocWithZone:(NSZone *)zone { @synchronized(self) { if (sharedInstance == nil) { sharedInstance = [super allocWithZone:zone]; return sharedInstance; } } return nil; } -(id)init { self = [super init]; if (self != nil) { // initialize stuff here } return self; } @end Not sure if it's ok to overwrite both alloc and allocWithZone: like this...?

    Read the article

  • can I get .class from generic type argument?

    - by Mike S
    I have the following class: public abstract class MyClass<T extends Object> { protected T createNewFromData(Reader reader){ GSON.fromJSON(reader,T.class); // T.class isn't allowed :( } } How do I pass a Class<T instance into there? Is there some wierd and wacky work around? Is there a way to get a Class<T reference other than from a pre-instantiated Object of type T? It won't let me do this either: T t = new T(); Class<T> klass = t.class; ANSWER BELOW Thanks to the accepted answer, here is the solution: Type type = new TypeToken<T>(){}.getType(); return gson.fromJson(reader, type);

    Read the article

  • Nested property class

    - by user998405
    I got 1 parent property class and 3 child property class. Here is my example Parent class public class blcSalesParam { public string selectFrom { get; set; } public string pageAction { get; set; } } Child class public class blcDeliveryOrder { public int? DeliveryID { get; set; } public string DeliveryCode { get; set; }

    Read the article

  • Singleton Creation preference

    - by cwieland
    You can create singletons in a variety of ways. I am wondering which is better between these. +(ServerConnection*)shared{ static dispatch_once_t pred=0; __strong static id _sharedObject = nil; dispatch_once(&pred, ^{ _sharedObject = [[self alloc] init]; // or some other init method }); return _sharedObject; } I could see that this compiles down to something very fast. I would think that checking the predicate would be another function call. The other is: +(ServerConnection*)shared{ static ServerConnection* connection=nil; if (connection==nil) { connection=[[ServerConnection alloc] init]; } return connection; } Are there any major differences between the two? I know these are probably similar enough to not worry about it. But Just wondering.

    Read the article

  • State management using the Application class in ASP.Net applications

    - by nikolaosk
    I have explained some of the state mechanisms that we have in our disposal for preserving state in ASP.Net applications in various posts in this blog. You can have a look at this post , this post , this post and this one . I have not presented yet an example in using the Application class/object for preserving state within our application. Application state is available globally in an application.The way we access Application State is through the HttpApplication object's Application property. Let...(read more)

    Read the article

  • EF 4’s PluralizationService Class: A Singularly Impossible Plurality

    - by Ken Cox [MVP]
    Entity Framework’s new 4.0 designer does its best to generate correct plural and singular forms of object names. This magic is done through the PluralizationService Class found in the System.Data.Entity.Design.PluralizationServices namespace and in the System.Data.Entity.Design.dll assembly. [Before you ask… Yes, I’ll post my example page, the service, and the project source code as soon as my ISP makes ASP.NET 4 RTM available. Stay tuned.] Anyone who speaks English is brutally aware of the ridiculous...(read more)

    Read the article

  • Building a better .NET Application Configuration Class - revisited

    - by Rick Strahl
    Managing configuration settings is an important part of successful applications. It should be easy to ensure that you can easily access and modify configuration values within your applications. If it's not - well things don't get parameterized as much as they should. In this post I discuss a custom Application Configuration class that makes it super easy to create reusable configuration objects in your applications using a code-first approach and the ability to persist configuration information into various types of configuration stores.

    Read the article

  • Using the Parallel class to make multithreading easy

    - by thycotic
    Kevin has posted about the Parallel class and how to use it to easily do multiple operations at once without radically changing the structure of your code.  Very neat stuff.   Jonathan Cogley is the CEO of Thycotic Software, an agile software services and product development company based in Washington DC.  Secret Server is our flagship enterprise password vault.

    Read the article

  • Design review , class design

    - by user3651810
    I have class design for storing patient information could you please review the design and let me know anything wrong or not corrent I have designed three interfaces IPatient IPatientHistory IPrescription IPatient Id Firstname LastName DOB BloogGroup Mobile List<IPatientHistory> ----------------------- GetPatientById() GetPatientHistory() IPatientHistory HistoryId PatientId DateOfVisit cause List<IPrescription> ----------------------- GetPrescription() IPrescription PrescriptionId PatientHistoryId MedicineName totalQty MorningQty NoonQty NightQTy

    Read the article

  • Deploying Reports using the ReportingServices2005 Class and the RS Utility

    Much of the routine administration of Reporting Services (SSRS), such as the routine deployment of RDL reports, can be automated by using the Reporting Service 2005 class library and web services. To make things easier, Microsoft supply the RS utility to run Visual Basic code as a script. It is an intriguing system, with a lot of potential, as Greg Larsen explains.

    Read the article

< Previous Page | 59 60 61 62 63 64 65 66 67 68 69 70  | Next Page >