C# Foreach statement does not contain public definition for GetEnumerator

I’m having a problem with a Windows Form application I’m building in C#. The error is stating “foreach statement cannot operate on variables of type ‘CarBootSale.CarBootSaleList’ because ‘CarBootSale.CarBootSaleList’ does not contain a public definition for ‘GetEnumerator’”. I can’t seem to understand what is causing this. This is the code that is throwing up the error: … Read more

“Multiple definition”, “first defined here” errors

The problem here is that you are including commands.c in commands.h before the function prototype. Therefore, the C pre-processor inserts the content of commands.c into commands.h before the function prototype. commands.c contains the function definition. As a result, the function definition ends up before than the function declaration causing the error. The content of commands.h … Read more

What does threadsafe mean?

Eric Lippert has a nice blog post entitled What is this thing you call “thread safe”? about the definition of thread safety as found of Wikipedia. 3 important things extracted from the links : “A piece of code is thread-safe if it functions correctly during simultaneous execution by multiple threads.” “In particular, it must satisfy the need for … Read more

What is the meaning of “exclusive” and “inclusive” when describing number ranges?

The following function prints the powers of 2 from 1 through n (inclusive). This means that the function will compute 2^i where i = 1, 2, …, n, in other words, i can have values from 1 up to and including the value n. i.e n is Included in Inclusive If, on the other hand, your book had said: The following function prints the powers of … Read more

Error with multiple definitions of function

I am trying to relearn C++ after taking an intro course a few years ago and I’m having some basic problems. My current problem occurs when trying to use a friend function. Here is my code in 2 files. First: Second: The error I am getting is “multiple definition of `funct()’”. Am I using the … Read more