name-clash

C++/VS2005: Defining the same class name in two different .cpp files

久未见 提交于 2020-01-04 02:41:05
问题 Somewhat of an academic question, but I ran into this while writing some unit tests. My unit test framework (UnitTest++) allows you to create structs to serve as fixtures. Usually these are customized to the tests in the file, so I put them at the top of my unit test file. //Tests1.cpp struct MyFixture { MyFixture() { ... do some setup things ...} }; TEST_FIXTURE(MyFixture, SomeTest) { ... } //Tests2.cpp struct MyFixture { MyFixture() { ... do some other setup things, different from Tests1}};

How to use generics and inherit from parent class without causing name clash?

╄→гoц情女王★ 提交于 2020-01-02 23:13:42
问题 I have a parent class in Java called Flight . I have children classes: JetFlight , NormalFlight , etc. which inherit from Flight . I want all the children classes to implement compareTo from the Comparable interface. I want them to inherit from Flight because I want to use polymorphism (for example, initiate a Flight array and fill it with objects of JetFlight , NormalFlight , etc.). This is my code for the parent class: public abstract class Flight { public abstract int compareTo(Object o);

How to use generics and inherit from parent class without causing name clash?

别说谁变了你拦得住时间么 提交于 2020-01-02 23:13:33
问题 I have a parent class in Java called Flight . I have children classes: JetFlight , NormalFlight , etc. which inherit from Flight . I want all the children classes to implement compareTo from the Comparable interface. I want them to inherit from Flight because I want to use polymorphism (for example, initiate a Flight array and fill it with objects of JetFlight , NormalFlight , etc.). This is my code for the parent class: public abstract class Flight { public abstract int compareTo(Object o);

Name clash when overriding method of generic class

余生长醉 提交于 2019-12-20 15:43:58
问题 I'm trying to understand the name clash error I get with the following code: import java.util.*; import javax.swing.*; class Foo<R extends Number> { public void doSomething(Number n, Map<String, JComponent> comps) { } } class Bar extends Foo { public void doSomething(Number n, Map<String, JComponent> comps) { } } Error message: error: name clash: doSomething(Number,Map<String,JComponent>) in Bar and doSomething(Number,Map<String,JComponent>) in Foo have the same erasure, yet neither overrides

Name clash when overriding method of generic class

丶灬走出姿态 提交于 2019-12-20 15:43:40
问题 I'm trying to understand the name clash error I get with the following code: import java.util.*; import javax.swing.*; class Foo<R extends Number> { public void doSomething(Number n, Map<String, JComponent> comps) { } } class Bar extends Foo { public void doSomething(Number n, Map<String, JComponent> comps) { } } Error message: error: name clash: doSomething(Number,Map<String,JComponent>) in Bar and doSomething(Number,Map<String,JComponent>) in Foo have the same erasure, yet neither overrides

Python multiple inheritance name clashes [closed]

亡梦爱人 提交于 2019-12-13 09:48:35
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I have a question about name clashes in python. If I have something like: class A: a='a' class B(A): a='b' class C(A): a='c' class D(C,B): pass D.a will print c , is there any way to retrieve B.a from D or A.a ? 回答1: Yes, you can do exactly what you suggest: class D(C, B): a = A.a 来源: https://stackoverflow.com

Java name clash error, a method has the same erasure as another method

心已入冬 提交于 2019-12-12 05:56:54
问题 I have two classes as follows class QueryResult: public class QueryResult { ... public static List sortResults(boolean ascending, List<QueryResult> toSort) { ... } } and class CaseResult: public class CaseResult extends QueryResult { ... public static List sortResults(boolean ascending, List<CaseResult> toSort) { ... } } I am getting the following error: Name clash: The method sortResults(boolean, List) of type CaseResult has the same erasure as sortResults(boolean, List) of type QueryResult

Name Clash even though I'm not using both interfaces

纵饮孤独 提交于 2019-12-12 05:11:25
问题 I'm getting this annoying message : Error:(8, 8) java: name clash: save(java.lang.Iterable) in org.springframework.data.repository.CrudRepository and save(java.lang.Iterable) in org.springframework.data.jpa.repository.JpaRepository have the same erasure, yet neither overrides the other I'm not using CrudRepository in my code, so how come im getting this weird message? How can I fix it? 回答1: Its a dependency issue. The following dependency resolves the issue <dependency> <groupId>org

Java name clash error, despite different method signatures

我怕爱的太早我们不能终老 提交于 2019-12-10 03:11:28
问题 For fun, I'm trying to implement a "MultiMap" collection, like what already exists in the Apache Commons library. I'm getting an interesting error with my "remove(K key, V value)" method. The compiler says that there is a name clash - that it has the same erasure as "remove(Object, Object) of type Map". But there is no such method defined in the java.util.Map interface! Only a "remove(Object)" method - with one parameter, as opposed to my two parameter version. What's even more interesting is

How to use generics and inherit from parent class without causing name clash?

耗尽温柔 提交于 2019-12-07 19:16:30
I have a parent class in Java called Flight . I have children classes: JetFlight , NormalFlight , etc. which inherit from Flight . I want all the children classes to implement compareTo from the Comparable interface. I want them to inherit from Flight because I want to use polymorphism (for example, initiate a Flight array and fill it with objects of JetFlight , NormalFlight , etc.). This is my code for the parent class: public abstract class Flight { public abstract int compareTo(Object o); } and this is the code for one of the children classes: public class JetFlight extends Flight