473,387 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Whats the problem with my code?

Expand|Select|Wrap|Line Numbers
  1. /**
  2. * With Visual C++ 2005 Express Edition
  3. *
  4. */
  5.  
  6. //--------- Main.cpp
  7. #include <iostream>
  8. #include "Persona.h"
  9. using namespace std;
  10.  
  11. int main(){
  12.  
  13.     Persona::Persona *mPersona = new Persona::Persona();
  14.     mPersona->setNombre("Israel");
  15.  
  16.     cout<<"Fin del programa"<<endl;
  17.     cin.get();
  18. }
  19.  
  20. //------- Persona.h
  21. #if !defined( PERSONA_PERSONA_H )
  22. #define PERSONA_PERSONA_H
  23.  
  24. #include "Telefono.h"
  25. #include <iostream>
  26. #include <string>
  27. using namespace std;
  28. namespace Persona{
  29.  
  30.     class Persona{
  31.         friend class Telefono::Telefono;
  32.     private:
  33.         string nombre;
  34.         Telefono::Telefono *telefono;
  35.     public:
  36.         Persona();
  37.         ~Persona();    
  38.  
  39.     };
  40. }
  41.  
  42. #endif
  43.  
  44. //---------- Persona.cpp
  45.  
  46. #include "Persona.h"
  47.  
  48. namespace Persona{
  49.     Persona::Persona(){
  50.         nombre = "";
  51.         telefono = new Telefono::Telefono();
  52.     }
  53.     Persona::~Persona(){ }
  54.     void Persona::setNombre(string nombre){
  55.         this->nombre = nombre;
  56.     }
  57. }
  58. //------------ Telefono.h
  59.  
  60.  
  61. #if !defined( TELEFONO_TELEFONO_H )
  62. #define TELEFONO_TELEFONO_H
  63.  
  64. #include <iostream>
  65. #include <string>
  66. #include "Persona.h"
  67. using namespace std;
  68.  
  69. namespace Persona{
  70.     class Telefono{
  71.  
  72.         friend class Persona::Persona;
  73.     private:
  74.         string numero;
  75.         Persona::Persona *persona;
  76.     public:
  77.         Telefono();
  78.         ~Telefono();
  79.     };    
  80. }
  81.  
  82. #endif
  83. //------- Telefono.cpp
  84.  
  85.  
  86. #include "Telefono.h"
  87.  
  88. namespace Persona{
  89.  
  90.     Telefono::Telefono(){
  91.         numero = "";
  92.         persona = new Persona::Persona();
  93.     }
  94.     Telefono::~Telefono(){  }    
  95. }
  96.  
  97. // El error q
Feb 12 '07 #1
0 741

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: asdf | last post by:
Hello! Can someone tell me whats wrong with this piece of code: Option Compare Database Option Explicit Sub retrieve() Dim rst As ADODB.Recordset Dim i As Integer
6
by: Simon Mansfield | last post by:
Im trying to make a C program that takes in a date (birthday) and tells the user how many days it has been since that date. So far I have got this... It compiles ok but then crashes, with no idea...
6
by: Jesper, DK. | last post by:
A little preamble A year ago I had a very odd bug in my program, in an if clause it picked and executed the else statement even though the if clause should evaluate to true. Normally you know that...
21
by: Paul Tremblay | last post by:
Hi All, I am a veteran C/C++ programmer (Unix background) and I want to get to speed with Visual Studio .Net I have legacy C/C++ code that I want to use in my application. However, I'm not...
8
by: buc | last post by:
I have a simple combox on the screen that is bound via a datareader to a stored proc in sql that returns a simple string. The code is 'load stored proc then dReader =...
3
by: Vaidas Gudas | last post by:
I has web project on virtual pc, maked with framework 2.0. there I was used the method role.roleexists("admin") and everything was worked good. but when i replace this project on my local machine,...
4
by: sophie | last post by:
Whats going on here: Read in a number as a string: scanf("%s", &number); number = 12345, for arguements sake Print it like this its fine:
20
by: Snis Pilbor | last post by:
Whats the point of making functions which take arguments of a form like "const char *x"? It appears that this has no effect on the function actually working and doing its job, ie, if the function...
4
by: LoneHunter01 | last post by:
Basically, I just need a general direction on where to go for this. Yes, this is for a school project, though it's strictly an optional one (and I have tried many solutions, one in-depth). We've...
0
Ali Rizwan
by: Ali Rizwan | last post by:
Hi all, i m having a problem with this code. Actually i want to refresh connection by closing and opening it. But the problem is that it do well when i update once but when i update it once more...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.