Banfa 597 Posting Pro Featured Poster

Now you've imagined it write it just like that. If its a pointer deference it using a *

Banfa 597 Posting Pro Featured Poster

L2 and L3 have type Row* so (L3*L3) + L2 is pointer arithmetic (except * is not valid in pointer arithmetic in that way).

You want to operate on your objects not the pointers to them so a sprinkling of * is required to dereference the pointer into an object *L3

Banfa 597 Posting Pro Featured Poster

You can not hardcode every string.

You need a data file you can put strings into, with each string you should put data defining its fan, pan, tan, lan membership (a 1 or 0 for each one or a single field of bits defining all of them for instance.

Then alter your program to work off the file. Initially you could read the file and store it in memory, later when the file gets big you may need to work directly off the file.

That way you should be able to build a program that has exactly the same functionality as your current program but reads a data file for all strings. Once you have a program like that making it do more is a simple matter of adding data to the file, no more coding required.

Maybe you could even expand the program to ask questions when it get unrecognised words to enable it to categorise them and add then to the data file so it becomes a learning program.

Banfa 597 Posting Pro Featured Poster

This is C++, you should be using new not malloc. This will allow you to remove that nasty cast. Casts should be avoid if possible, basically a cast (especially a C style cast) short circuits all your compilers type checking which is bad.

In you loop CSPair-> always references the first item in the array. Basically you put data into the first item in the array 10 times but never put anything into items 1 - 9.

The magic number 10 appears all over you code. Avoid magic numbers, define a const somewhere and use that.

Personally I would typedef rather than #define my integer types.

Banfa 597 Posting Pro Featured Poster

Not without using a loop or an stl algorithm.

Anyway C++ has its own version of this function is() declared in <local>

Banfa 597 Posting Pro Featured Poster

Is test::mypred a static member function of your class test?

If not then this wont work, you can not pass a class member as a callback like that because the called code in std::partition has no object test on which to call the callback function.

To access the data in your function you need to write a predicate functor (an object that acts like a function) to allow access to your data.

Unfortunately since you have failed to post most of the declarations of all the symbols you use it is quite hard to give an example but assuming that temp_myvec1_col is declard something like vector<vector<int> > temp_myvec1_col; it would be something like

class myPredicate
{
public:
    myPredicate(test& aTest)
    : theTest(aTest)
    {
    }

    bool operator()(int i) 
    {
	if(theTest.flag_equiv[i] == 1)
	    return true;
	else
	    return false;
    }

private:
    test& theTest;
}

assuming that flag_equiv had public access or that myPredicate was a friend of test and you would call it something like

bound = partition(temp_myvec1_col[i].begin(), temp_myvec1_col[i].end(), myPredicate(*this));

myPredicate(*this) creates an instance of the class myPredicate with a reference to the current instance of test held within it. Since it implements operator() this instance of myPredicate can be called just like a function so when it is called operator() has access to the calling parameters and the data members of myPredicate allowing it access to the data in the instance of test.

Banfa 597 Posting Pro Featured Poster

operator+ is not in any way dependent on having any sort of constructor unless you have chosen to implement it in this form (for a general type T)

T T::operator+(const T& rhs)
{
    return T(*this) += rhs;
}

Which is dependent on having a copy constructor and an operator+=.

However you do not have to implement your operator+ like this you can just implement it directly without reference to other members of the class.

Banfa 597 Posting Pro Featured Poster

Then your operator+ is simply:

BigInt& operator+(const BigInt&);

To preserve the correct addition (+) semantics and handle memory correctly operator+ has to return a object not a reference as do all binary operators also since it should not change the actual object it is called upon it can be const so it should be

BigInt operator+(const BigInt&) const;
Banfa 597 Posting Pro Featured Poster

I know nothing about Java except that most C++ programmers tend to underestimate how efficient it can be. I suggest you ask in the Java forum.

Banfa 597 Posting Pro Featured Poster

As for the void addtracks (int mp3database[]) i am struggling with this.
musicfile is the name of the struct, i want to enter my data into a musicfile contained by the array

so perhaps

void addtracks (struct musicfile)

Your type isn't struct musicfile because you typedef it. The structure is actually unname, to be named it would need a name immediately after the keyword structure in the definition but that does not matter. The name of your type is musicfile.

For any general type T you can declare a pointer to that type as a variable or function parameter as T* SymbolName; additionally for a function parameter you can declare a pointer as T SymbolName[]; .

In void addtracks (int mp3database[]) the second format is used so int represents T. To declare a pointer to musicfile parameter you therefore put musicfile in place of T or void addtracks (musicfile mp3database[]) .

Banfa 597 Posting Pro Featured Poster
void addtracks (int mp3database[]);

This declares a function that takes a pointer to an int, however you want a function that takes a pointer to a musicfile. Which bit of it do you think you need to change?

fflush(stdin); //fflush to clear previous keyboard input

Calling fflush on stdin is at best a platform specific extension and at worst undefined behaviour. Undefined behaviour is bad because literally anything can happen so it should be avoided.

If it is an extension supported by your platform then you could very easily run into trouble if you port you code to a different platform.

Banfa 597 Posting Pro Featured Poster

Its very important that the \ is the very last character on the line and is not followed by comments or any white space.

If it is you will get some very unhelpful compiler errors especially if it is just a stray space some visually the code looks correct.

Know your keyboard shortcut for you editor to show white space.

Banfa 597 Posting Pro Featured Poster
// Are we painting an edit control?
  if(nCtlColor == CTLCOLOR_EDIT)
  {
    // Yes ...
    // Set the text color to red
    pDC->SetTextColor(RGB(255, 0, 0));
    ...
  }

MSDN also says

To change the background color of a single-line edit control, set the brush handle in both the CTLCOLOR_EDIT and CTLCOLOR_MSGBOX message codes, and call the CDC::SetBkColor function in response to the CTLCOLOR_EDIT code.

so that if statment should be a little more complex (or have further else if clauses.

@mrnobody all of those if statements contain the same block of code so I would not do it like that. If you have direct control of the values IDC_EDIT1 - IDC_EDIT200 arrange the values so that you can implement the condition IDC_EDIT1 <= ID <= IDC_EDIT200 or find some other short cut to answer the question, is it one of my edit boxes.

mitrmkar commented: Yes, a good catch +5
Banfa 597 Posting Pro Featured Poster

Sorry I completely overlook your initial description of your problem.

You haven't actually said how response is declared but assuming char response; then the problem is that when you read response data is left in the input buffer, this data is then read into paragraph in the getline statement.

The way stdin (the console) works normally is that the program does not see anything until the user presses enter. You ask for a yes/no (y/n) response the user presses y and enter and after this the input buffer contains 'y\n' (\n being a newline character).

You read the y into response and leave the '\n' in the buffer so when you call getline, which reads the next line from stdin or put another way all the characters upto the next line the first thing it sees is '\n' so it returns empty.

This is easy to test without altering your program at the prompt "would you like to continue" type in something like "yYes I would" followed by enter and you should find the program doesn't stop but paragraph contains "Yes I would".

You need to make sure you read anything left over in the input buffer after reading in response.

Banfa 597 Posting Pro Featured Poster

Sounds like you have show white space switch on in your options/preferences. If so those dots/tabs are just display artefacts Visual Studio is not saving them in the file.

Banfa 597 Posting Pro Featured Poster

In my experience the most likely cause of that type of behaviour is another part of the program writing outside object boundaries. Or writing outside of the boundaries of the object that p2 points at

The second possibility clearly can happen if there is no p2.

For the first possibility when you introduce the variable it alters where a lot of things are stored and the order they are stored in (if only inserting 1 thing somewhere in the order). If a piece of code is writing to somewhere it shouldn't be then this movement of where variables are stored can be the difference between it writing somewhere critical to program operation and somewhere not critical to program operation.

You might want consider using valgrind if you are using Linux, or OS X it can help with detecting that sort of problem.

You might also want to consider splitting you code up into some functions just for readabilities sake if nothing else.

Banfa 597 Posting Pro Featured Poster

Yes a sting is an STL container so you can use all the usual STL algorithms on it like for instance count_if.

Also you should use the functions defined in the header local, specifically is rather than the value comparisons if (paragraph >="A" && paragraph <="Z") to check for the case ( http://www.cplusplus.com/reference/std/locale/ctype/is/ ).

Use these to facilities and you can reduce both of you while loops to 1 line of code and a 1 line function (predicate).

Your calculation of nonblank is faulty you have assumed that all characters that are not letters are blank but clearly punctuation and digits are not blank and not letters.

Banfa 597 Posting Pro Featured Poster

Have you thought of just checking to see if the line is blank before tokenising it?

You tokenising routine needs to be robust enough that when it hits a problem it fails in a way you can catch and deal with (normally by just ignoring the line and possibly outputting an error).

That means not assuming anything, if you tokenise a line you expect to have 4 parameters separated by commas on then you don't assume the tokenisation worked. You check every pointer that gets returned to you before you use it for some other purpose.

Basically if something can go wrong you check it is going to before you do it. For everything.

Banfa 597 Posting Pro Featured Poster

This sort of thing is not trivial because the different months have different numbers of days and February has different numbers of days in it depending on the year. The are, at least, 2 approaches

  1. Convert the dates to the number of days past a given epoch date, 1 Jan 1970 is popular. Then you can just take the highest from the lowest. In fact many structures like this store there internal data in this form rather than as separate day/month/year. It also make comparisons and other arithmetic easy.

  2. Write an algorithm that works out the number of days left in the month of the earlier date, adds all the days in the months of the months in between the 2 dates and then adds the number of days into the month of the later date. There are all sorts of corner cases, dates in the same month for instance and short cuts, dates with whole years between them you can calculate days in the year rather than having to calculate individual months.
Banfa 597 Posting Pro Featured Poster

If this is QT then the QT documentation specifically says that you must only inherit from QObject once and QObject is a base class of QWidget.

You will have to break the diamond. That might mean having a abstract class that BaseView and ButtonView both inherit from that does no inherit QWidget and not having ButtonView inherit from BaseView.

Banfa 597 Posting Pro Featured Poster

You have a ; at the end of line 18 that should be there.

However once you fix that I would expect all of these types of comparison if (pass = KazzyB) tp cause an error, or certainly not do what you expect.

Banfa 597 Posting Pro Featured Poster

If you want to return a string then...

return a string :D

OK sorry it sound fucisious but what I mean is do not return an allocated array of characters actually return a string object. That hides all the allocation, decallocation errors for you.

In suggest inside your function you use a ostringstream object to create your string, although I guess you may be calling vsprint or similar.

Anyway you can still return a string.

This is C++ start getting used to and using the faciities it provides rather than trying to rely on older C methods.

Banfa 597 Posting Pro Featured Poster

My (rustly) recollection from 3-4 years ago is that you need to make a class library project in your solution (I am assuming you're using visual studio)

File -> New -> Project... -> Select "CLR" From Tree -> Select "Class library" from the right hand pane.

Fill in the name and press ok.
Develop your class.

Then in you normal projects you just add your class library either

1. If your normal project is in the same solution as the class library by selecting the project (useful for debugging since they both get built using the same configuration)
2. By selecting the output DLL of your class library project.

Banfa 597 Posting Pro Featured Poster

You probably should be overriding the OnCtrlColor handler of the parent window.

Intercepting OnDraw for all your edit boxes sounds tedious.

Banfa 597 Posting Pro Featured Poster

Not really it is your choice or the choice of where you work.

The main thing is to be consistent with what you do.

Banfa 597 Posting Pro Featured Poster

It's not like solving 1 equation with multiple unknowns it is solving 1 equation with multiple unknowns.

i am using the cos inverse of the vector dot product of the 2 lines (connected sides of the polygon) which returns the correct angle between them, the problem is i cannot figure out weather the angle is inside the polygon or outside?

However this sounds like you have some additional constraints that you have not shared. What are these 2 vectors? What 2 lines, a polygon generally has more than 2 lines.

is there more to this problem than you have stated?

Banfa 597 Posting Pro Featured Poster

yes you separate the class definition and the member definitions like this

// This is normally in a header file foo.h
class foo
{
	public:
		void DoNothing();
};
// This is normally in a separate cpp file foo.cpp
void foo::DoNothing()
{
    cfee.AddNothing();
}

That way the cpp files can include the definitions of any classes they use and any class can use any other class.

That is why it is standard practice to implement a class in 2 files, 1 header file and 1 cpp file and to only use those files for defining the class in question.

Banfa 597 Posting Pro Featured Poster

Again from the website you have already linked to, the equations given still hold true for concave polygons.

You can't calculate the angles of an irregular polygon by definition since they are irregular they can be anything you want them to be. The only reason you can calculate the angles for a regular polygon is because you have the conditional restraint that they must all be the same.

For an irregular polygon with N sides if you know N-1 of the angles you can calculate the Nth angle. The forumla for that is on the website you have already linked to.

Banfa 597 Posting Pro Featured Poster
for (int index = 0; index <= limit - 1; index++)

is a bit awkward with the <= limit -1 . Just use the strictly less than comparison to the actual array size (or limit of valid elements), as in

for ( int index = 0; index <  limit ; index++ )

It is more than a bit awkward I have seen program errors introduced by this <= limit -1 construct that are not possible with < limit .

It needs a slightly different situation but imagine that

  1. index has type unsigned rather than int

  2. limit is not a constant it is a variable of the program which has a value >= 0

I found this exact bug in a digital television receiver where presumably the original coder hadn't thought of the possibility of a channel having no audio streams at all although that is perfectly valid.

So if everything is unsigned and limit is 0 then limit - 1 is a very large number, 0xFFFFFFFF on a 32bit system and suddenly you have an infinite loop.

This error does not happen with < limit

vmanes commented: Very interesting observation. +5
Banfa 597 Posting Pro Featured Poster

Interestingly if you had bothered to read the text of that page below the Java applet it tells you exactly how you can calculate the interior angle for a regular polygon and further it links boldly at the top of the page to a page about exterior angles too.

Salem commented: LOL +19
Banfa 597 Posting Pro Featured Poster

You can't pass arrays. You may invoke the constructor with an array in the calling code but what gets passed is a pointer. With-in the context of a function declaration int a[] declares a pointer so IntegerSet::IntegerSet( int a[]) and IntegerSet::IntegerSet( int* a) are equivilent. In both cases the parameter a is a pointer.

Just trying to add clarity and this is also the reason Fbody sensibly sugests passing the size of the array along with the pointer.

Of course this is C++ so you should be avoiding arrays altogether an using vectors which solve the knowing what size it is problem, not to mention your constructor would reduce to something like

IntegerSet::IntegerSet(const vector<int>& a)
: set(a)
{
}
Banfa 597 Posting Pro Featured Poster

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs,
and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

Rich Cook

Banfa 597 Posting Pro Featured Poster

This one?

1>d:\...\common_deFINITIONS.h(18) : error C2086: 'unsigned char X1[16]' : redefinition

This happens when the compiler sees 2 definitions of the same object (not the OOP type) such as when you define something in a header file that doesn't use multiple inclusion protection via #defines and then included it multiple times directly or indirectly into a single cpp file.

Banfa 597 Posting Pro Featured Poster

But I am not using any objects.

It's an ambiguous use of the term object (that we all do).

In an object orientated programming sense an object is an instantiation of a class. However in the context of any executable code an object is any thing that takes up space in memory such as a char array.

Ancient Dragon commented: good point. +27
Banfa 597 Posting Pro Featured Poster

I have included Common_Definitions.h in BC.h and RS.h.
#ifndef Common_Definitions_h
#define Common_Definitions_h
#include "Common_Definitions.h"
#endif

Inclusion protection preprocessor symbols like this are good, but they should go inside the file they are protecting not round every place it is included. Common_Definitions_h should have the structure

#ifndef Common_Definitions_h
#define Common_Definitions_h

... declarations and inclusion of other files here

#endif

and then you just included it like this

#include "Common_Definitions.h"

Your link errors are a rresult of the contents of Common_Definitions.h

1) Common_Definitions.h
unsigned char X1[16];
char X2[4];

struct xyz
{
UINT32 X3;
unsigned int X4[4];
long X5;
int X6;
int X7;
};

You are defining X1 and X2 when you should be declaring them. A definition basically causes the compiler to create an object, in this case the are variables so it reserves data for them. A declaration informas the compiler that the object exists somewhere and that it doesn't need to create it it can just use it.

When you define data in a header file and that header is included into multiple C files every object file produced by the compiler has space reserved for that variable. Then when the linker trys to link all the object files it finds that the variable is defined in multiple locations and since it has no way of telling what to do sensibly in that situartion it stops with a "multiple definition" or "already defined" error.

Banfa 597 Posting Pro Featured Poster

Line 26 LINKEDLIST *list = malloc(sizeof(list)); Line 34 - 35

STORE *newVacantStore;
newVacantStore = malloc(sizeof(newVacantStore)); newVacantStore = malloc(sizeof(newVacantStore));

In both of these cases you have allocated the size of the pointer not the size of the object pointed to. Pointer is likely to be 4 bytes on a 32bit system (or 8 on a 64bit system).

When you malloc you need to allocate the size of the thing pointed to not the size of the pointer so line 26 should be LINKEDLIST *list = malloc(sizeof *list); or LINKEDLIST *list = malloc(sizeof(LINKEDLIST)); I leave line 35 for you to correct.

Banfa 597 Posting Pro Featured Poster

Talking of IDEs recently I have been using Geany, which is less of an IDE and more of an extended editor.

However the reason I mention it is that (assuming you already have the compiler installed but I am using it on Linux so that is less of a problem than it might be on Windows) without having to create a project file it is able to compile and link 1 source file programs (it can also start a make session for larger projects).

If you happen to be just doing a little testing on small code snippets that is a very useful feature, you can have several files open and just switch to any one and compiler it as a separate program.


The only IDE that WaltP doesn't seem to have mentioned is Eclipse althopugh that is a little complex may be for a beginner and it has some features I find irritating (mainly its belief that it is a file system not an IDE).

Also isn't Bloodshed DevC++ a little bit unsupported now?

Banfa 597 Posting Pro Featured Poster

so i can say that when passing arguements in function, c compiler will do promotions and demotions to the data. but it will not genereate any error / warning for mismatching type in function declaration and function call.

No you can say when passing arguments into a function the c compiler may do promotions and demotions to the data for certain types that it has knowlege of how to promote/demote and that it is not required to generate any diagnostic message to indicate that such a conversion was done.


Remember

  • The c compile can only automatically convert some types not all types. Pointers are a case where it can do the conversion but many compilers produce a warning.

  • Just because the standard doesn't require the compiler to emit a diagnostic message for a given situation doesn't mean that all compilers wont emit a warning.
  • The compiler is never required to emit wanrings or errors, only diagnostic messages.
Banfa 597 Posting Pro Featured Poster

I didn't say that rand() was inadequate for this purpose, only that that wasn't a very good way of calling it with a link to better ways to use rand()

Banfa 597 Posting Pro Featured Poster

You have given your assignment.
You have given the code you have.

But you have not said what the problem you are having is.
Is it an issue with compiler errors? Then post the errors.
Is it an issue with the program not performing as expect or desired? Then post the desired behaviour and the actual behaviour including all the inputs you gave to the program.


Finally 1 + rand() % 6; is not a good way to generate a random number because of poor randomness in the low bits of the output of some random number generators. Read this.

Banfa 597 Posting Pro Featured Poster

Look up the STL copy_backward algorithm

Banfa 597 Posting Pro Featured Poster

Because C is fairly lax about types and if it has an automatic conversion from the type given to the type required then it will silently do it for you. C knows how to convert float to int so it just happens.

This was one of the issues fixed in C++ which is much more strongly typed, compile the code you have given as C++ and you get the following diagnostic messages

bytes.c:6: warning: passing `double' for converting 1 of `float get_float(int)'
bytes.c:9: warning: passing `double' for converting 1 of `float get_float(int)'

Banfa 597 Posting Pro Featured Poster

As I see, your second solution relies on
that we declare memory not as a data,
but a pointer to a data.
In this case we do not change the pointer,
therefore function can be const.
But in this case outsider can change memory,
if they know its adress.

If they know its address but since it is a private member of myclass they have no way of getting its address.

A also think of a third solution:
creating a global memory table,
which is a map from class -> data,
but my problem is, that I cannot create map of references,
and copying the whole class to the map is no good.
I want to avoid pointer,
because outsider can change the value of the data.
It is possible to mimic references somehow,
kind if ID for example,
and create the memory table?

Any solution relying on global data is likely to have problems and will certainly break the design pardgim of encapsulation (not to mention what if they get a pointer to that global data and alter it?) Additionally you seemed to be inferring that there would be more than one instance of myclass which would each need there own separate store which would be hard to do with global memory.

You also seem to infer that references somehow don't have the problem that pointers have when it comes to external …

Banfa 597 Posting Pro Featured Poster

I would question how you are using the vector to store the results. How will you differentiate between results from different functions, or worst results from different functions that take different numbers of parameters?

Anyway your storage scheme aside I see 2 possible solutions. You could declare memory mutable. A mutable data member can have its value changed by a const function. However you need to be careful and use mutable in a good semantic way. The data objects that get changed should not be a aprt of the state of the object and I think that may be they are in this case.

I use mutable when I declare mutex objects in classes to protect multithreaded access, the mutex is not part of the classes state it is just protecting code that should only be run by 1 thread at a time such as getters which would normally be const.

The other option is to have a separate class to store the results, you can then call out to that class from your const function, remember a const function only says that the class data will not change. Soemthing like this

class resultCache
{
  vector<double> memory;

public:
    void storeResult(double x1, double x2, double x3, double result)
    {
      memory[0] = x1;
      memory[1] = x2;
      memory[2] = x3;
      memory[3] = result;
    }

};

class myclass{
resultCache* prc;

public:
  double myfunc(double x1, double x2, double x3) const;
  myclass():
  prc(new resultCache)
  {
  }

};

double myclass::myfunc(double x1, double x2, …
Banfa 597 Posting Pro Featured Poster

When you declare a data member static there is a single copy of that data member used by all instances of the class so a.n and CDummy::n refer to the same variable.

CDummy::n is incremented every time a class is constructed and decremented when the class is destroyed. So the first cout 7 classes have been created, a, the 5 in the array b and the one newed that c points to, the constructor has been called 7 times and CDummy::n incremented 7 times from 0 to 7.

The c is deleted, the destructor is called and n is decremented so at the next cout CDummy::n has a value of 6 (7 - 1).

PDB1982 commented: Excellent explanation - Thank you! +1
Banfa 597 Posting Pro Featured Poster

start by reading this and relevant pages it links to.

The basic purpose of an assignment operator is to copy all the data from the source object into the current(target) object making sure, if necessary, that buffers are allocated as required if the class uses pointers to allocated data rather than only uses data types (which you class doesn't I believe).

jonsca commented: Rep for this monster thread +3
Banfa 597 Posting Pro Featured Poster

I will get round to reading that article once I get home, its a bit long to interrupt work for.

I was trying to keep things simple by not talking about the compilers ability to elide object copies/constructions when returning from functions I was aware of it though. The fact remains that if the result is assigned to an object a minimum of 1 object assignment or instatiation must happen, obviously how efficient that is rather depends on the object in question and what data it contains.


I must say I am glad to here about the extension of the lifetime of anonymous temporary objects when assigned to a reference, otherwise there was a rather large and obvious hole in the references are safe paradgim. Now all I need to do is get used to using it because there are some bits of C++ that just seem unnatural to a C programmer.

I have to ask does this lifetime extension continue to work if, for instance, that reference is then returned from the current function?

Banfa 597 Posting Pro Featured Poster

For a managed C++ ref class the assignment operator(operator=) is not generated by default, if you want your class to be assignable you have to create an assignment operator.

Rect2 = Rect;
    Rect2.MoveRect(10, 30);

These lines assign Rect to Rect2 and then move Rect2 just as before, there is no change.

Banfa 597 Posting Pro Featured Poster

You seem to be treating as a single step, get the return value of a function, what is actually 2 steps

  1. Return a value from a function

  2. Assign that value to a variable

Both have associated efficiencies as follows

Return a value from a function

  • Return by value - not efficient, but sometimes necessary. sometimes you will end up with a nameless temporary object, it is always a posibility. The return value will have to be copied into the nameless temporary object (copy constructor call) and then deleted in the calling function once it has been used.

  • Return by pointer - efficient, only a pointer is returned, a few bytes and there is no need for any constructor destructor calls.
  • Return by reference - again efficient, there is no need for any constructor/destructor calls. How references are implemented is not specified anywhere (that I know of) but it seems likely that internally they will hold a pointer or something similar so again only a few bytes are required.

Assignment
What is important when considering assignment efficiency is what you are assigning to

  • An object - not efficient, there will need to be either a copy constructor or assignment operator call.

  • A pointer - efficient, no method calls on the class just copying the pointer data, a few bytes.
  • A reference - again efficient, no method calls on the class just copying the reference data, a few bytes.
Banfa 597 Posting Pro Featured Poster

So firstly in my above example I called MoveRect on the object Rect but is sounds like you need to do it on Rect2. Which object have you called MoveRect on?

What do you not understand about the operation of the new MoveRect? You have plenty of other member functions, it works in exactly the same way they do.

I can't help you much with the intelisense, that is a feature of the IDE you are using and I do not use MSVC on the whole. Surfice it to say that the intelisense not working correctly should not stop you programming (although it may be slightly frustrating). Often things like intelisense do not work properly in the presence of compielr errors. have you tried

Exiting you IDE and restarting it
Performing a project rebuild all