Big class contains Format-interfcase and Format-class. The Format-class contains the methods and the interface has the values of the fields. I could have the fields in the class Format but the goal is with Interface. So do I just create dummy-vars to get the errors away, design issue or something ELSE?
KEY: Declaration VS Initialisation...
(Scala 2.7.7:) I don't get used to 2d-Arrays. Arrays are mutable, but how do I specify a 2d-Array which is - let's say of size 3x4. The dimension (2D) is fixed, but the size per dimension shall be initializable. I tried this:
class Field (val rows: Int, val cols: Int, sc: java.util.Scanner) {
var field = new Array [Char](rows)(cols)
...
I have two C++ files, say file1.cpp and file2.cpp as
//file1.cpp
#include<cstdio>
void fun(int i)
{
printf("%d\n",i);
}
//file2.cpp
void fun(double);
int main()
{
fun(5);
}
When I compile them and link them as c++ files, I get an error "undefined reference to fun(double)".
But when I do this as C files, I don't ge...
In Thinking in C++ by Bruce eckel, there is an example given regarding friend functions as
// Declaration (incomplete type specification):
struct X;
struct Y {
void f(X*);
};
struct X { // Definition
private:
int i;
public:
friend void Y::f(X*); // Struct member friend
};
void Y::f(X* x) {
x->i = 47;
}
Now he explained this:
N...
We found something similar to the following (don't ask ...):
namespace N {
struct A { struct B; };
}
struct A { struct B; };
using namespace N;
struct ::A::B {}; // <- point of interest
Interestingly, this compiles fine with VS2005, icc 11.1 and Comeau (online), but fails with GCC:
global qualification of class name is inva...
I get the error in this part of the code:
void baklanges(list<MataIn> lista);
{
int n = text.length();
for (int i = 0; i < n/2; i++) {
char temp = text.at(i);
text.at(i) = text.at(n-1-i);
text.at(n-1-i)= temp;
}
cout<<"Texten baklanges:\n"<<text<<endl;
}
I don't see any problem in the code,does any of you?
...
I've installed MTL on my Fedora Core 12 x64 system, but when building an application I get the following error:
In file included from /usr/local/include/mtl/matrix.h:41,
from /usr/local/include/mtl/mtl.h:40,
from ltiSystem.hxx:4,
from strTools.hxx:4,
from ff.cxx:3:
/usr...
Hi,
I would like to find a better way to do this:
XmlNode nodeXML = xmlDoc.AppendChild( xmlDoc.CreateXmlDeclaration( "1.0", "utf-8", String.Empty) );
I do not want to think about "utf-8" vs "UTF-8" vs "UTF8" vs "utf8" as I type code. I would like to make my code less prone to typos. I am sure that some standard library has declatred ...
Hey guys,
I have my code below that consits of a structure, a main, and a function. The function is supposed to display two parameters that have certain values, both of which point to the same structure.
The problem I dont know how to add the SECOND parameter onto the following code :
#include<stdio.h>
#define first 500
#define sec 5...
I have Class Email,
there is parameter "bcc" in her constructor.
Its actually list of emails for copies.
There is no fixed number of these emails and later i have to have possibility to extend this list.
//constructor prototype
Email::Email(vector<string> bcc)
So i want to use type vector or list for that and function push_back().
H...
Right now, my project has two classes and a main. Since the two classes inherit from each other, they are both using forward declarations. In the first object, right underneath the #include statement, I initialize two enums, before the class definition. I can use both enums just fine inside that class. However, if I try to use those enum...
When I compile function with "gcc -o dene -Wall -ansi -pedantic-errors dene.c"
,gcc emits no error.(can you look a line which starts with char ....,in if loop,)
static void remove_negation(char *s,char *s1)
{
char **cmainp=malloc(sizeof(char*)*1);
int len=0;int d=0; int i=0;
...
I've seen this kind of issue on SO (and on the Net overall) quite a few times. For example here:
http://stackoverflow.com/questions/1884529
Earlier today I was trying on a JSP (regular .jsp, not .jspx) to do this, because I stupidly cut/pasted some example found on the net:
<%@ taglib prefix = "c" uri = "http://java.sun.com/jstl/core...
I have a WPF user control ...which is in MVVM. The user control(which contains a listview) need data from the page (where it is included). I have to set a property in View's code behind to get this data input. Will this comply with MVVM(But MVVM pattern do not support adding code in code behind file of view as far as i know).if not, what...
C++ requires all types to be defined before they can be used, which makes it important to include header files in the right order. Fine. But what about my situation:
Bunny.h:
class Bunny
{
...
private:
Reference<Bunny> parent;
}
The compiler complains, because technically Bunny has not been completely defi...
I've written a .cpp file with a number of functions in it, and now need to declare them in the header file. It occurred to me that I could grep the file for the class name, and get the declarations that way, and it would've worked well enough, too, had the complete function declaration before the definition -- return code, name, and par...
The following macro is defined in our code:
#define MSGMacro(obj, arg) MyPaymentClass obj(arg)
Where MSGMacro is used to creates the object of type MyPaymentClass using code like
MSGMacro(Card, 1);
MSGMacro(Cash, 2);
----
---- //removed unwanted things to keep question cleaner.
All the above code is in one cpp file, Now the pro...
Is there any difference in declaring objects in Objective-C between (1) and (2), besides the style and personal preference?
(1) One-line declaration, allocation, initialization.
Student *myStudent = [[Student alloc] init];
(2) Multi-line declaration, allocation, initialization.
Student *myStudent;
myStudent = [Student alloc];
myStu...
My understanding is that C++ allows static const members to be defined inside a class so long as it's an integer type.
Why, then, does the following code give me a linker error?
#include <algorithm>
#include <iostream>
class test
{
public:
static const int N = 10;
};
int main()
{
std::cout << test::N << "\n";
std::min(9, ...
Is it "better" to initialize AS3 class variables in the class constructor? Or can I just initialize them to their default value when I declare them at the top of my class? I ask because when there's a lot of class variables, it appears inefficient to declare them in one place and then initialize them in another when I could easily do b...