Building as both a struct and a class?

Questions, problems and discussion about compiling FreeOrion.

Moderator: Oberlus

Post Reply
Message
Author
User avatar
mem359
Dyson Forest
Posts: 214
Joined: Sun Jun 08, 2014 1:18 am

Building as both a struct and a class?

#1 Post by mem359 »

I'm missing something, and I'm hoping for advice.

C++ normally complains if you don't use unique identifiers.
In Condition.h, we have

Code: Select all

struct FO_COMMON_API Building : public ConditionBase {
while in Building.h we have

Code: Select all

class FO_COMMON_API Building : public UniverseObject {
Both of these headers are used in Building.cpp, and probably other places.
How is there not a conflict (since structs and classes are pretty much interchangeable)?
I was going to post an issue about renaming one of those Building variables (to reduce confusion), but I wanted to check if this was done by design (some overload trick I'm not thinking of).

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Building as both a struct and a class?

#2 Post by Geoff the Medio »

The Building condition is in the Condition namespace. The Building class derived from Universe is not.

User avatar
mem359
Dyson Forest
Posts: 214
Joined: Sun Jun 08, 2014 1:18 am

Re: Building as both a struct and a class?

#3 Post by mem359 »

Okay, I see that now. Thanks.

(Saw that it wasn't in the Building namespace, but missed the one in Condition. That is one file where indenting everything inside the namespace would have helped.)

Post Reply