Questions tagged [static-class]

In object oriented programming a static class is a class whose members must be accessed without an instance of the class. Its members must be created as static.

In object oriented programming a static class is a class whose members must be accessed without an instance of the class. Its members must be created as static.

90 questions
0
votes
2 answers

Dilemma of static class containg only static methods

So I have this task of mapping two hotel catalogs; both are csv files. I created two classes, based on their responsibilities : 1. CatalogManager : handles the I/O operations for catalogs. 2. CatalogMapper : Handles the mapping task of two…
bhootjb
  • 1,501
  • 1
  • 21
  • 33
0
votes
2 answers

Static class, another thread and events

I am trying to learn networking by making my own little network library. Currently I have a list of new clients that a code like this can use. The NewClientConnected() method returns true if there's anything in the list and removes the first…
Gisle Aune
  • 13
  • 4
0
votes
4 answers

Nested static class C#

I'm wondering if I can get object which called static method of static class ex: public class Person { private static class TelephoneLine { public static string sharedString = string.Empty; public static void NotifyOnCall() …
TrN
  • 1,230
  • 2
  • 17
  • 32
0
votes
2 answers

How can I initialize the d (pointer) of the pimple idiom of an static class?

Here is my header code: #ifndef CLANDTYPES_H #define CLANDTYPES_H class CLandTypes { public: CLandTypes(); ~CLandTypes(); private: class Pimple; static Pimple * d; }; #endif // CLANDTYPES_H because it should be a static class I…
oRUMOo
  • 153
  • 1
  • 2
  • 11
0
votes
1 answer

What do the terms interface class, static class, and abstract class mean in C++?

Can anyone please explain me what is an interface class? Abstract Class? and Static Class? Please explain me with a simple example in C++. Since i am a beginner to C++. Also, please give me some links where I can easily learn C++.
0
votes
1 answer

Ways of accessing a static nested class in Java

I have learnt that static nested class should be accessed like a field of outer class(line 2). But even instantiating the inner class directly worked (line 1). Can you please help me understand? public class OuterClass { public OuterClass() …
Rk R Bairi
  • 1,289
  • 7
  • 15
  • 39
0
votes
1 answer

c++ static observer class

I have two programs: a server and a client class client { private: Network net; Gui gui; }; Here's the Network class class Network { public: void receivePacket(packet) { Protocol::readPacket(packet) } }; Here's…
Coodie_d
  • 35
  • 6
0
votes
0 answers

Python - static interface for hardware IO

This a somewhat general question so forgive me if I'm breaking any guidelines. I'm writing a JQuery / websocket / Flask application that uses a Raspberry Pi to monitor some sensors as well as manage some active hardware. Multiple classes and…
0
votes
0 answers

C# Set property value of static Class with Reflection

I have to read, in C#, a file .ini, where each section correspond to a static Class and the values in each section correspond to a property of the class. I do an example: [Database] path='test.db' userid='root' password=123123 I have created a…
Luca
  • 1
  • 3
0
votes
2 answers

Static method vs. instance method in typical 3-tier business layer

Currently, I am building a typical 3-tier web app with ASP.NET MVC. I have set it up with dependency injection (Autofac) like below: public class UserController : BaseController { private readonly IUserService _userService; public…
MillDol
  • 121
  • 2
  • 11
0
votes
0 answers

Can a static class know when it's being unloaded at application exit?

First, because I know everyone tries to help, I know this is not considered a good pattern. Second, yes, I know about the singleton pattern and use it often. Consider this more a question of "Can you" rather than "Should you". That said, is there…
Mark A. Donohoe
  • 28,442
  • 25
  • 137
  • 286
0
votes
2 answers

How to get and set data in static string dynamically

I have a desktop application, which verifies the finger and prompt the result I am calling that app in wpf, then this all is showing in asp.net On asp.net user put the finger, results comes to him how is that done? On asp.net I created a static…
KarachiCoder
  • 87
  • 1
  • 12
0
votes
1 answer

android populate another class ArrayList

I am trying to make a code to populate an array from one class from the outputs of an async task. Now the code is giving me null reference.. Putting the code below ARRAY CLASS: public class ClientDiscovery { public static ArrayList
Noel Carcases
  • 711
  • 1
  • 7
  • 27
0
votes
0 answers

Android Parcelable vs static class

I was having a discussion with another developer and the argument arose that a static class is better then using parcelable when passing data between activities. When i check on this site the recommendation seems to be that parcelable is faster…
j2emanue
  • 60,549
  • 65
  • 286
  • 456
0
votes
1 answer

How to mock final variable defined under layered static classes using mockito?

i have code like below ScheExeService.ScheduleId scheduleID = ScheExeService.getOneTimeScheduleId(nl.getCompany(), workItem.getId()); ScheExeService.Schedule schedule = ScheExeService.loadSchedule(nl, scheduleID.getId()); Calendar cal =…
rid
  • 5
  • 2