Questions tagged [redeclaration]

Use this tag for questions related to redeclaration, such as overwriting a function.

64 questions
3
votes
2 answers

redeclaration of instance and static function

class me { private $name; public function __construct($name) { $this->name = $name; } public function work() { return "You are working as ". $this->name; } public static function work() { return "You are working…
Rizky Ramadhan
  • 7,360
  • 4
  • 27
  • 31
3
votes
2 answers

Xcode : Invalid redeclaration of 'ViewController'

I just finished my app and it was working fine, but all of a sudden after pressing File -> duplicate, I have a message saying Invalid redeclaration of 'ViewController' Please help me out if you can guys? Thank you import UIKit class…
J.BAT
  • 99
  • 2
  • 9
3
votes
1 answer

Redefinition inconsistency in clang between struct and int

The following program gives no error when compiling with clang: namespace X { struct i {}; } namespace Y { using X::i; struct i {}; } int main() {} Let's use int instead of struct, then we get: namespace X { int i; } namespace Y…
2
votes
3 answers

Redeclaration of enumeration problem in C

I'm having a compilation error in my C project. I have a header file that contains this enumeration: typedef enum { RAD_ALLOWED= 0, RAD_STOPPED , RAD_OFF } Values_E; and in another header file with this enum: typedef enum { …
SmallX
  • 89
  • 7
2
votes
1 answer

Readonly public property redeclared as readwrite in private interface.. understanding a bit more

I've read the Property redeclaration chapter in The Objective-C Programming Language document and I'd like if some of you can clarify me the following property redeclaration: // MyObject.h public header file @interface MyObject : NSObject { …
Gianni Costanzi
  • 6,054
  • 11
  • 48
  • 74
2
votes
1 answer

Modelica/Dymola Redeclare Component through integer

I'm currently working on a model, where I want to use an Array of Integers in order to redeclare the shown components: Image of the blocks and redeclaration-window My goal is to have i.e. the blank at the top left corner redeclared to a pump if the…
2
votes
1 answer

C++ multiple declarations in a local scope

As far as I know, in C++ one can declare the same name multiple times, as far as it has the same type in all these declarations. To declare an object of type int, but NOT define it, the extern keyword is used. So the following should be correct and…
SasQ
  • 14,009
  • 7
  • 43
  • 43
2
votes
2 answers

How to re-declare a class object in C++?

I'm experimenting on classes and constructors and i'm trying to choose a specific declaration for a class object depending on something like an if-statement. I've written a simple example showing what i tried to do, which is not working. Even though…
Alex Matt
  • 209
  • 1
  • 4
2
votes
0 answers

Multiple errors while upgarding web application IE9 browser

Multiple errors while upgrading web application IE9 browser: 1. SCRIPT5009: 'Date' is undefined 2. SCRIPT5009: 'Array' is undefined 3. SCRIPT5039: Redeclaration of const property 4. SCRIPT5009: 'jQuery' is undefined 5. SCRIPT5009: '$' is…
2
votes
0 answers

Why re-declaration of global variables is valid but not local of local variables?

If I declare i to be a global variable twice, then it works fine: #include int i;int i; int main(void) { printf("%d",i); return 0; } But not if I declare it locally (twice) #include int main(void) { int i;int…
brokenfoot
  • 11,083
  • 10
  • 59
  • 80
2
votes
6 answers

C++ allows redefinition of global (const) variable?

I'm a bit confused by global constants. My (beginner level) understanding is that 'global' variables are defined outside of a block and have program scope (source: http://www.learncpp.com/cpp-tutorial/42-global-variables/). But the program:…
badger5000
  • 650
  • 7
  • 17
2
votes
3 answers

c++ fix syntax debug with *lec=fopen();

I am working on some C++ code with a friend that know better than I do, and the code has a bug, I'd like help to fix this, since I couldn't figure out how... EDIT The compiler stops at line 59 where: FILE *ecr("result.txt","wt"); is written. There…
adrienlucca.net
  • 677
  • 2
  • 10
  • 26
1
vote
1 answer

redeclaration of var console

I'm using Hoptoad to get error reports of my JavaScript and recently I got this error: redeclaration of var console the backtrace is not very useful: internal: : :0:in `{anonymous}()' and I know it happened on "Mozilla/5.0 (X11; U; Linux x86_64;…
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
1
vote
1 answer

DXE7: "type A = type B" and var x (of type A):= A.create leads to E2010 incompatible type compile error. Why?

A. Short summary of the problem: type A = class(TObject) end; B = type A; The compiler error E2010 incompatible types: 'B' and 'A' is shown, when you instantiate a variable of class B in the following style: var TheB: B; begin TheB:=…
KaiW
  • 74
  • 1
  • 8
1
vote
1 answer

Invalid redeclaration of "StyleKitSettableImage" in Paintcode

I have two Paintcode Stylekit swift classes to write two different images into two different views. The first one works well, but when I import the second one these two function @objc protocol StyleKitSettableImage { func setImage(image:…
Fabio Cenni
  • 841
  • 3
  • 16
  • 30