Created
May 19, 2012 02:12
-
-
Save Chavao/2728669 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| chavao@ubuntu:~/Desktop/cpp/proj$ g++ -c -g rumo.cpp | |
| chavao@ubuntu:~/Desktop/cpp/proj$ g++ -g -g main.cpp | |
| main.cpp: In function ‘int main()’: | |
| main.cpp:8: error: aggregate ‘Rumo r’ has incomplete type and cannot be defined | |
| chavao@ubuntu:~/Desktop/cpp/proj$ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| class Rumo; | |
| int main() | |
| { | |
| Rumo r; | |
| cout << "Valor: " << r.obterValor() << endl; | |
| return 0; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| class Rumo | |
| { | |
| private: | |
| int valor; | |
| public: | |
| void setValor(int v); | |
| int obterValor() const; | |
| }; | |
| int Rumo::obterValor() const | |
| { | |
| return valor; | |
| } | |
| void Rumo::setValor(int v) | |
| { | |
| valor = v; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment