Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. class MyString
  2. {
  3.     char* m_pStr;  
  4. public:
  5.     MyString();
  6.     MyString(char* string);
  7.     friend ostream& operator<<(ostream& os, const  MyString& string);
  8. };
  9.  
  10. //Global.h
  11. #include <iostream>
  12. #include "myString.h"
  13.  
  14. using namespace std;
  15. ostream& operator<<(ostream& os, const  MyString& string); (сюда пишет ошибку missing type specifier - int assumed. Note: C++ does not support default-int)
  16.  
  17.  
  18. //Global.cpp
  19. #include "Global.h"
  20. ostream& operator<<(ostream& os,const  MyString& string)
  21. {
  22.     os << string.m_pStr (не могу так написать, потому что компилятор не видит этого поля, почему ??) ;
  23.     return os;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement