C# :: Move Class To Its Own Project And Keep Its References?

Apr 3, 2014

I was wondering if there is way to convert a C# class to its own project and it automatically keeps its references.

View 3 Replies


ADVERTISEMENT

C++ :: How To Hold Pointers / References To Abstract Class

Nov 15, 2014

I have an abstract class named Terrain, and a class named RoadMap, which supposed to hold an N*N array of Terrains. But I'm not sure what type should the RoadMap class hold:

Code:
#ifndef TERRAIN_H
#define TERRAIN_H
class Terrain {

[Code] ....

I can't use an array of refernces here, so I tried this:

Code: Terrain** terrain; and then I thought this was the way to go:

Code: Terrain (*terrain)[]; But now I'm not sure.

The N*N matrix size supposed to be determined according to a given input... What type should I use there?

View 2 Replies View Related

C++ :: Move Constructor In Class Definition?

May 5, 2013

I am unable to understand how a move constructor works in this example of code. If someone could break down the process of what is taking place and explain to me on why to use a move constructor.

Code:
class MyString {
MyString(MyString&& MoveSource) {
if( MoveSource.Buffer != NULL ) {
Buffer = MoveSource.Buffer; // take ownership i.e. 'move'
MoveSource.Buffer = NULL; // set the move source to NULL i.e. free it
}
}
};

Example from "SamsTeachYourself: C++ in One Hour a Day"

View 1 Replies View Related

C++ :: Custom Array Class For A Project

Oct 15, 2014

I am currently working on a custom "Array" class for a project, and I have run into an error I don't quite understand the source of. The relevant code is as follows:

template<typename T> class Array {
private:
T errValCopy;
public:
T __errVal__;
uint16 __size__;
T* __ptr__;
Array(const T& errorValue);

[Code] ....

When I try to run the following code:

Array<Array<int>> a(Array<int>(-1));

The error log tells me there is no appropriate default constructor available. If I understand it correctly, "default constructor" refers to the constructor which lets you just write Array<int> a; instead of Array<int> a(...);, but I can't see where in the code such a situation occurs...

View 2 Replies View Related

C++ :: Create A Class Representing Project Activities

Mar 24, 2013

Create a class representing project activities. In this class include all the required data members and member functions. Each activity should have a record of activity duration, calculated early start, early finish, late start, late finish, free float, and total float. Each activity may or may not maintain a list of its successors and predecessors. Provide your design in UML and implement it in C++ using an interface head file and an implementation source file. I do not understand classes or UML designs.

View 2 Replies View Related

C++ :: Global Class Instance In Multi-File Project

May 3, 2013

I'll just tell you in short how my Problem looks like: I should implement a New Class in a SourceCode i didnt write myself. The source code is extremely sized (i think approx >100.000 Lines of Code), so i dont want to change too much in it in order to get my Implementation done.

MY problem looks simplicified like that: Starting from 3 classes and my new class the pseudo-code looks like that:

Class1(){
float* m_CalibX, m_CalibY;
.. }
Class2(){
char* m_ImageData[];

[Code] .....

So, i need Parameters from 3 different classes to insert in my NewClass. The 3 Classes dont know anyting about each other. So, i need to implement a Class-Instance from Type NewClass which is known by the other 3 Classes. I did solve it in this way:

//ClassInstance.h

#include "NewClass.h"
static NewClass ClassInstance

I just wrote a headerfile with a class-instance which is getting included by the other 3 Classes. So they all know the same Instance and writing their Parameters into it. Is this a decent solution or could it happen to get bugs/ logical mistakes with it?

View 2 Replies View Related

C# :: Opening A Second Form Project Within A Project

Jan 22, 2014

I have a project which does a specific thing, like an open file dialog.

I would like to open it in a different project on a click of a button.

Also, It has a different namespace.

I'm guessing that it would involve a "using" statement to add the namespace And I will have to add reference to an *.exe or *.dll -> I'll have to look up how to make a *.dll, I know where the *.exe file is.

I have searched for a different things on Google, but I don't think that I am looking for the correct phrase (which is always frustrating...)

View 12 Replies View Related

C++ :: Scope Of References?

Apr 22, 2013

Did a little Googling on this but couldn't find anything definitive. Is it safe to do something like

Code:
void MyClass::myFunc(){
my_type_t &foo = some_obj->get_member_reference();
store_for_later(&foo);
}

Then at some pointer later in execution, another function uses the pointer passed to store_for_later.

View 5 Replies View Related

C++ :: Swap Between Two References?

May 28, 2013

I have the following code segment:

Code:

void Swap(Number& num1, Number& num2)
{
cout<<"Before swap:"<<num1<<" "<<num2<<endl;
Number& temp=num1;
num1=num2;
num2=temp;
cout<<"After swap:"<<num1<<" "<<num2<<endl;
}

[code]...

to which the output is:

Code:

Before swap:13 11

After swap:13 11

13 11 that seems confusing.

why doesn't Swap() swap the two Numbers?

View 8 Replies View Related

C# :: Programmatically Add Dll References?

Jan 11, 2014

I am trying to make a utility program for work that will update multiple projects with local dll references. Basically I work with two solutions (for talk sake solutIon1 and solutIon2). Generally solutIon1 will reference the dll's built In solutIon2 which reside on a server. However for debugging proposes I sometimes need to D/L the solutIon2 projects and build them local-ally, so that I can reference the solutIon2 dll's local-ally (this Is so that I can easily attach the dll and step Into the code). However this require changing the reference paths, so that I am pointing to the local-ally built dll's, which Is quite a laborious task.

So the question is how would I update references in solution1 from the program that I am making. I don't really know what to start reading about as I have never done anything like this before.

View 6 Replies View Related

C++ :: Vector Of Pairs Of References?

Jun 19, 2014

I am attempting to combine two vectors into a vector of pairs. I want to be able to alter the first and second of each pair and have those alterations reflected in the original vectors. I thought the following code might work but get compilation errors about a lack of viable overload for "=" for the line with the call to std::transform:

void f()
{
std::vector<int> a = {1,2,3,4,5};
std::vector<int> b = {6,7,8,9,0};

[Code].....

View 3 Replies View Related

C++ :: Declaring A Valarray Of References?

Sep 26, 2014

Is it permissible to declare, for example, `std::valarray<int&>`? If so, how do I initialize such if the `valarray` is a class member?

View 3 Replies View Related

C++ :: What Are Rvalue References And Temporary Objects

Dec 30, 2014

What rvalue references are? How are they useful? What are temporary objects?

View 1 Replies View Related

C++ :: Testing For References To Identical Objects

Jun 18, 2014

I am checking to see if two references are bound to the same object. My instincts tell Me, "Check their addresses. If they match, they are bound to the same." At the same time, I have not found anything in the C++ standard which would support this approach. Am I missing something? Is there wording which backs up My instincts? Is there a standard function to do this?

View 4 Replies View Related

C++ :: Parameter Pack Of Constant References

Aug 20, 2013

I have this basic prototype:

struct int_wrapper{int i;};
template <const int_wrapper&... IPack>
void display_all(const int_wrapper&, IPack...);

But when I try to compile it, the compiler says IPack is not a type on the last line. Are packs of references not allowed?

View 5 Replies View Related

C++ :: Range-based Looping Over Container Of References?

Mar 6, 2015

Is it possible to create a class that stores (non-const) references to some objects and enables users direct access by using range-based for loops on them?

Code: class container {
public:
void add(int& value);
void remove(int& value);
...
};
int main()
{
container c;
for (auto& value:c) {
// `value' should be accessible as type `int&' instead of being a pointer, `std::reference_wrapper<int>' or something like that
}
}

View 6 Replies View Related

C++ :: Passing Variadic References To Template Function?

Dec 14, 2014

I'm having some problems in understanding how the code below works and why it produces the output it produces.. What I'd expect is that both functions, namely `add_1' and `add_2', would print the same output; but I've been proven wrong :/ So why does the second one get different memory addresses for the same variable?

Code should be self-explaining:

Code: template<typename... Types>
void add_1(Types&&... values)
{
// by the way: why do i have to use `const int' instead of `int'?
std::vector<std::reference_wrapper<const int>> vector{
std::forward<Types>(values)...};
std::cout << "add_1:" << std::endl;
for (const auto& value:vector) {
std::cout << &value.get() << std::endl;

[code].....

View 4 Replies View Related

C++ ::  2 Errors In Passing Values / References To Function

Jan 28, 2014

#include "stdafx.h"
#include <iostream>
#include <math.h>
#include <time.h>
#include<iomanip>
#include<array>
#include <algorithm>

using namespace std;
const int AS = 6;
void FillingRandomly(int (*)[AS]);
void printing(int (*)[AS]);

[Code] ....

Basically I have to create an array, fill it, and then print it on screen. The tricky thing is that need to use pointers to fill it and print and later on sort it. My problem is that with this code is that i get

Error2error C2109: subscript requires array or pointer typec:userspcdesktopusbanthonydocumentsvisual studio 2012projectsessaieessaieessaie.cpp55
and
5IntelliSense: expression must have pointer-to-object typec:UserspcDesktopUSBAnthonyDocumentsVisual Studio 2012ProjectsEssaieEssaieEssaie.cpp55

Whenever I try to run it.

View 2 Replies View Related

C++ :: RValue - References As Return Values Of Functions

Aug 13, 2014

I am trying to understand RValue-references as return values of functions. First let's consider a simple function, that transforms a string into upper case letters.

const std::string
toUpper(std::string orig) {
std::transform(orig.begin(), orig.end(), orig.begin(), ::toupper);
return orig;

[Code] .....

It compiles, but I get the output 0 . Here I am wondering why the code above does not move the substr correctly while the code below does (prints out 1):

const std::string&&
no_sense(std::string abc) {
abc = abc.substr(1, 1);
return std::move(abc);

[Code] .....

In both cases abc is a temporary object inside of the function and gets deleted after the function is left. But why does the second version work and the first one does not?

cat.substr(1, 1)

And as my last question. Why doesn't

return std::move(abc.substr(1, 1));

work?

View 3 Replies View Related

C++ :: Why Cannot Dynamic Memory Allocation Work With References

May 5, 2013

Why cant a dynamic memory allocation work with references? I was told that references work with const pointers deep down so shouldn't this be legal code?

int &&a=new int;

My compiler says that a entity of int* cannot be used to initialize a entity of int&&?

Does that mean that the compiler thinks of them as different types except deep down a reference is implemented with a pointer? Is this right?

View 14 Replies View Related

C# :: Cyclic References In A Database Access Layer

Jan 21, 2015

I'm looking to implement a Database Access Layer for the project I'm working on, it's a mature project and I'm trying to simplify the database access and as far as possible and remove the Database logic from the Business logic.

Bringing in an ORM solution isn't an option at the moment so I'm looking at bringing in DAO objects to break the coupling. The problem I can't get around in my head is how to avoid Cyclic references

We currently have 2 projects

BL contains types such as Customer, Component and Product which need saving to the Database, the Database project can't know about these items or it would create the cyclic dependency.

I tried adding Dao items to the DB project to mirror these items and to also mirror the DB structure but that requires that the BL project knows how to convert between it's own types and the DAO types which is something I'd like to avoid.

I also tried inserting a third intermediate project that would control the conversion and saving, I called it my DAL project and tried adding functions that would take the BL item and perform CRUD operations but again I ran into the cyclic dependency issue.

My ideal solution would be that the BL project would just have to call a function along the lines of "SaveCustomer(Customer inCustomer)" and not have to worry about doing any conversion.

Is there a project structure that would allow for this?

View 1 Replies View Related

C++ :: Cloning Object - Store Pointers Instead Of References?

Apr 8, 2013

Is there a point in dynamically creating a pointer during runtime only to dereference it? (if that is the right term, as in *pointer, depoint it?)

In this case should I perhaps store pointers instead of references?

Inventory.cpp

Code:
bool Inventory::addItem(InventoryItem& item) {
addItemAmount(item);
if (item.getAmount() > 0) {
if (hasEmptySlot()) {
addNewItem(*item.clone());
return true;

[Code] ....

Also I was wondering, is there some sort of built-in cloning functionality or do I have to write the clone functions myself? When creating new instances I see that I can either pass the constructor properties or a reference to an object of the same type.

For instance:

Code:
new InventoryItem(index, name....);
new InventoryItem(const InventoryItem&);

Is the second one casting?

View 14 Replies View Related

Visual C++ :: No Circular References But Undeclared Identifier

Jun 11, 2014

Each of my header includes is protected by directives. I think I don't have to include Boolean in my work space because it is already included in the external dependencies section. and the Boolean.h is in the include path.

MachineShop, Boolean etc got undeclared identifier error

Tried to comment out the directives, to no avail.

Code:
#include <iostream>
#include <string.h>
#ifndef BOOLEAN_H_
# include "Boolean.h"
#endif
#ifndef PROCESS_H_
# include "Process.h"
#endif
#ifndef MACHINESHOP_H_

[Code] ....

View 2 Replies View Related

C++ :: Data Type Size - Performance With References

Aug 16, 2012

Here's what I'm trying to do : A simple readout that shows the input/feedback values for 10 different sensors (i.e. a motor, a thermocouple, light sensor, etc).

What I got so far:

The data is stored in 2 different arrays:

One array is a 2D string array that stores descriptions, and won't be changed:

Sensor ID, Sensor Type, Input Signal, Feedback Signal
["A"]["Motor"]["PWM Signal"]["RPM"]
["B"]["Thermocouple"]["N/A"]["TempC"]
etc

The second array is another 2D int array that stores all the data values:

Input Signal, Feedback Signal
[0][0] // for Sensor A, Input is 0 PWM, 0 RPM read from sensor
[0][25] // for Sensor B, Input is 0, 25C read from sensor
etc

My question: I'd like to re-write the code to incorporate the new things I learned in c++. Right now, the descriptions for all 10 sensors are in 1 array and the sensor values are in another array. If I use pointers to access the values, is there a performance difference between:

1. Keeping it as is, with 2 2d arrays
2. 1 big structure that has descriptions and sensor values for all 10 sensors (i.e. combining everything into 1)
3. 1 parent class, and 10 different objects for each sensor (i.e. splitting into 10)

View 2 Replies View Related

C++ :: Move A Character Around 2D Map?

Mar 3, 2013

How can I move a character around a 2D map? After some research and a bunch of work I made a function for movement:

unsigned int gamespeed = 100;
unsigned int stage = 1;
void controls()
{

[Code]....

Maps are stored in a different .cpp file

So this code works, but is complicated, ugly and evil (I have to make a pointer to the first map and change the pointer to the next map every time the user reaches the exit, without the pointer this code is, of course, incompatible). How can I reduce this code to be less evil/ugly or at least smaller?

Also it would be nice if the user could move around with arrows as well as with WASD

View 5 Replies View Related

C++ :: Can't Get Program To Move Forward

Feb 24, 2014

After I enter in the 8 digit account number the program just stops and I can't find where the logical error is

Code: #include <iostream>
#include <iomanip>
#include <string>
using namespace std;
bool validateLength(string);
bool validateDigit(string);
void calculateA(string);
void calculateB(string);
void calculateC(string);
bool validateService(string);

[code]......

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved