Questions tagged [circular-dependency]

circular dependency is a relation between two or more modules which either directly or indirectly depend on each other to function properly.

1693 questions
0
votes
2 answers

C++, circular dependencies, templates and user types

I am having troubles with the circular dependency between the classes A,B,C. The user type cfunction from class A points to the static method of C::F1. Here is the code: File A.h #ifndef A_H #define A_H #include "C.h" class C; template
justik
  • 4,145
  • 6
  • 32
  • 53
0
votes
0 answers

Circular dependency implementing double dispatch

Assume I have a base class Shape, and a derived class from Shape, Triangle, defined in a project X in Visual Studio. I also have a class Transformations in a project Y in which I want to be able to call dynamically the appropriate method: void…
Dooggy
  • 330
  • 2
  • 11
0
votes
1 answer

Spot problems with circular dependency

I am designing a system where two modules, one which gestions files and another users. For certain logic operations, they need the services offered by each other. Each module is represented by a singleton which implements a interface offering some…
Jsevillamol
  • 2,425
  • 2
  • 23
  • 46
0
votes
3 answers

How to fix a circular dependency for imports

I have three files: testimports module: #import moduleTwo import moduleOne hiString = "Hi!" moduleOne.sayHi() moduleOne: import moduleTwo class sayHi(): moduleTwo.printHi() moduleTwo: import testimports def printHi(): …
wrongusername
  • 18,564
  • 40
  • 130
  • 214
0
votes
2 answers

Base class with pointer to deriving object: How to tell both of each other's existence?

Here is a minimal example. I have a Base class that needs to know the Deriving class. In turn the Deriving class needs to know the Base class. So how can I define them, so that they know of each other's existence? class Base { Deriving*…
mskr
  • 375
  • 5
  • 14
0
votes
1 answer

C++ Circular Dependencies

I am relatively new to C++, and I am trying to write a simple 2D engine. However, there is a problem with the current structure which was okay in other languages (AS3 etc). I have two classes, one called DisplayObject, and another one called…
TommyX
  • 83
  • 2
  • 12
0
votes
1 answer

Having trouble to understand circular declaration

Hi i'm trying to create a factory method, that returns a derived class of class A, I'm having trouble understanding circular declaration, I hope you can help me solve this. Thanks. AChildOne.cpp #include "AChildOne.h" AChildOne.h #ifndef…
Zindan
  • 3
  • 1
0
votes
1 answer

Angularjs: nicer way to handle circular dependencies

Is there another way how to handle circular dependencies in Angular service than by using $injector.get()? Is require.js the right choice?
Amio.io
  • 20,677
  • 15
  • 82
  • 117
0
votes
2 answers

avoid Circular reference when using Unity 4.0 C#

I am not sure how to avoid circular reference in following scenario. Issue is stackoverflow due to circular reference. How do I use Lazy or another approach to resolve this? I don't like to pass the container everywhere as well. public class…
pats
  • 1,273
  • 2
  • 20
  • 43
0
votes
1 answer

Circular dependency with classes that can be initialized one from another

Well, the correct title of this question should be "Circular dependency with classes which instances can be initialized one from another". I have two classes (Index3i with integer data fields and Index3f with float data fields) that meant to be…
ezpresso
  • 7,896
  • 13
  • 62
  • 94
0
votes
5 answers

Design question - resolving circular dependency between objects

I got myself into a circular dependency between two classes, and I'm trying to come up with a clean solution. Here's the basic structure: class ContainerManager { Dictionary m_containers; void CreateContainer() { ...…
0
votes
2 answers

Should pointers be used to reduce header dependencies?

When creating a class that is composed of other classes, is it worthwhile reducing dependencies (and hence compile times) by using pointers rather than values? For example, the below uses values. // ThingId.hpp class ThingId { // ... }; //…
magnus
  • 4,031
  • 7
  • 26
  • 48
0
votes
0 answers

StructureMap and Project Dependency

Suppose I have the following structure in my C# solution: ServiceProject -- IBusinessLogic.cs -- Service.cs BusinessLogicProject -- IRepository.cs -- BusinessLogic.cs RepositoryProject -- Repository.cs In this case, I have BusinessLogicProject…
Husain
  • 784
  • 1
  • 9
  • 22
0
votes
0 answers

Can't build plugin because of circular dependencies

My plugin consists of a collection of other plugins written by myself and these plugins have circular dependencies in their class paths (and I don't see a way to remove those because the plugins rely on each other). The plugin runs just fine when…
Raven
  • 2,951
  • 2
  • 26
  • 42
0
votes
1 answer

Declaring, but not defining F# classes

Is there a way in F# to declare a class, but not define it like in C# or C++ or Java, or pretty much any other language, so that we can avoid the use of the and keyword? I have two fairly big classes that reference eachother, and I don't want to put…
user3685285
  • 6,066
  • 13
  • 54
  • 95