Click here to Skip to main content
15,917,568 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: "global namespace" ---what's meaning of this?? Pin
Renjith Ramachandran8-Apr-04 22:35
Renjith Ramachandran8-Apr-04 22:35 
Generalsocket send/recv Pin
Steve L.8-Apr-04 18:06
Steve L.8-Apr-04 18:06 
GeneralRe: socket send/recv Pin
johnny,Kim8-Apr-04 20:43
johnny,Kim8-Apr-04 20:43 
GeneralRe: socket send/recv Pin
toxcct8-Apr-04 21:49
toxcct8-Apr-04 21:49 
GeneralRe: socket send/recv Pin
Steve L.9-Apr-04 7:27
Steve L.9-Apr-04 7:27 
GeneralRe: socket send/recv Pin
toxcct9-Apr-04 10:30
toxcct9-Apr-04 10:30 
GeneralRe: socket send/recv Pin
Paul Ranson9-Apr-04 9:46
Paul Ranson9-Apr-04 9:46 
GeneralAccess to class in another file. Pin
Iceberg768-Apr-04 16:33
Iceberg768-Apr-04 16:33 
Hello,

I am writing a application in Visual C++ .NET 7.0. I'd like to keep my classes in seperate files to keep things organized, but I am having difficulty accessing classes from another file. Can someone help me find a solution accessing between files? I would rather not have multiple classes in a single file. What am I doing wrong?

Here is a simplified version:

Class1.h

#ifndef __Class1H__
#define __Class1H__

#include "Class2.h"

class Class1
{
public:
Class1();
~Class1();
//This doesn't work because it is in a different file!
Class1(Class2* object);
//This doesn't work because it is in a different file!
Class2 obj;

};
#endif // __Class1H__


Class2.h

#ifndef __Class2H__
#define __Class2H__

class Class2
{
public:
Class2();
~Class2();

};
#endif // __Class2H__


Class1.cpp

#include "Class1.h"

Class1::Class1()
{


}

Class1::~Class1()
{


}


Class2.cpp

#include "Class2.h"

Class2::Class2()
{


}

Class2::~Class2()
{


}
GeneralRe: Access to class in another file. Pin
Maxwell Chen8-Apr-04 17:00
Maxwell Chen8-Apr-04 17:00 
GeneralRe: Access to class in another file. Pin
Iceberg768-Apr-04 17:32
Iceberg768-Apr-04 17:32 
GeneralRe: Access to class in another file. Pin
Maxwell Chen8-Apr-04 17:47
Maxwell Chen8-Apr-04 17:47 
GeneralRe: Access to class in another file. Pin
Iceberg768-Apr-04 18:04
Iceberg768-Apr-04 18:04 
GeneralRe: Access to class in another file. Pin
Iceberg769-Apr-04 20:28
Iceberg769-Apr-04 20:28 
GeneralRe: Access to class in another file. Pin
Maxwell Chen11-Apr-04 16:39
Maxwell Chen11-Apr-04 16:39 
GeneralRe: Access to class in another file. Pin
Iceberg7611-Apr-04 20:09
Iceberg7611-Apr-04 20:09 
Generalneed helps for writing voice chat program in Visual C++ Pin
NgocHung8-Apr-04 15:12
NgocHung8-Apr-04 15:12 
GeneralRe: need helps for writing voice chat program in Visual C++ Pin
Timothy Grabrian8-Apr-04 15:41
professionalTimothy Grabrian8-Apr-04 15:41 
GeneralRe: need helps for writing voice chat program in Visual C++ Pin
NgocHung9-Apr-04 3:31
NgocHung9-Apr-04 3:31 
GeneralDoes Directory Exists Pin
Timothy Grabrian8-Apr-04 14:05
professionalTimothy Grabrian8-Apr-04 14:05 
GeneralRe: Does Directory Exists Pin
gUrM33T8-Apr-04 14:49
gUrM33T8-Apr-04 14:49 
GeneralRe: Thanks Pin
Timothy Grabrian8-Apr-04 15:12
professionalTimothy Grabrian8-Apr-04 15:12 
GeneralRe: Thanks Pin
8-Apr-04 15:38
suss8-Apr-04 15:38 
GeneralRe: Thanks Pin
Timothy Grabrian8-Apr-04 15:52
professionalTimothy Grabrian8-Apr-04 15:52 
GeneralWM_SYSCOMMAND & SC_MOUSEMENU Pin
Anonymous8-Apr-04 13:38
Anonymous8-Apr-04 13:38 
QuestionHow to override CEdit::Paste Pin
Hashim Saleem8-Apr-04 13:35
Hashim Saleem8-Apr-04 13:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.