14.07.2014, 09:43. Просмотров 394. Ответов 13
Доброго времени суток! Возник вопрос, существует что-то наподобие внешней декларации типов? например:
header.h :
C++ |
1
2
3
4
5
6
7
8
| #ifndef HEADER_H
#define HEADER_H
extern OtherType;
void some_func(OtherType a);
#endif |
|
header.cpp
C++ |
1
2
3
4
5
6
7
| #include <iostream>
#include "header.h"
void some_func(OtherType a)
{
std::cout<<a.data<<std::endl;
} |
|
main.cpp
C++ |
1
2
3
4
5
6
7
8
9
10
11
12
13
| #include "header.h"
struct OtherType
{
int data;
OtherType(){ data = 0;}
};
void main()
{
OtherType a = OtherType();
some_func(a)
} |
|