2 libraries with the same class

Hi
I am performing some experiences in order to better understand how namespaces work.
Consider the following code:
equipaa.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#ifndef EQUIPAA_H
#define EQUIPAA_H
// ...
// ... coisas ...
// ...
class MinhaClasse{
public:
	MinhaClasse()		{x = 0;}
	void setX(int novo_x)	{x = novo_x;}
	int getX()		{return x;}
	int dobro()		{return 2 * x;}
private:
	int x;
};
// ...
// ... e mais coisas coisas ...
// ...
#endif	//EQUIPAA_H 

equipab.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#ifndef EQUIPAB_H
#define EQUIPAB_H
// ...
// ... coisas ...
// ...
class MinhaClasse{
public:
	MinhaClasse()		{x = 0;}
	void setX(int novo_x)	{x = novo_x;}
	int getX()		{return x;}
	int triplo()		{return 3 * x;}
private:
	int x;
};
// ...
// ... e mais coisas coisas ...
// ...
#endif	//EQUIPAB_H 

main.cpp
1
2
3
4
5
6
7
8
#include <iostream>
#include "equipab.h"
#include "equipab.h"
int main(){
	MinhaClasse objecto;
	objecto.setX(7);
	objecto.triplo();
}


What is the reason for the compiler only consider an error when i try to use member-function dobro (from equipaa.h) instead of triplo ( from equipab.h )?

Thanks
Last edited on
#include <iostream>
#include "equipab.h"
#include "equipab.h"

shouldn't that be equipaA.h ?
yeap ... so it was strange :))))))

God ... how i hate copy paste!

Thanks
Topic archived. No new replies allowed.