473,387 Members | 1,722 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.

Communicating between 2 classes

TGF
Hello,

I have a little dilemma (At least it is to me). I have two classes, Class
A and class B, where Class A contains the UI thread and class B contains
another thread. I want to be able to communicate from ClassA to ClassB and
then from ClassB to ClassA. The problem comes in with the include files.
It seems there is some sort of overlapping where one is not defined when it
is supposed to be. This is expected and I cannot seem to find a decent
solution for it. Here are the classes. As you can see from the below
example. I cannot do both. If I take out the 'include <"classA.h"> from the
ClassB declaration and remove the parentClass member from ClassB, I can
communicate downward but not upward. Any help would be appreciated.

#include <"classA.h">
#include <"classB.h">
namespace App
{
public __gc ClassA : public System:Windows:Forms:Form
{
public:
...
private:
...
ClassB __gc *subclass;
...
};
}

#include <"classA.h">
#include <"classB.h">
namespace App
{
public __gc ClassB
{
public:
...

private:
...
ClassA __gc *parentClass;
...
};
}

-TGF
Nov 16 '05 #1
1 1018
If I'm not mistaking those are header files, and you're trying to
#include a file from itself. The corrections below are valid if we're
talking about header files. Also I never worked with managed
functions, but there shouldn't be any differences...

TGF wrote:
#include <"classA.h">
#include <"classB.h">
Move both includes from here to classA.cpp and add here:
class ClassB;
namespace App
{
public __gc ClassA : public System:Windows:Forms:Form
{
public:
...
private:
...
ClassB __gc *subclass;
...
};
}
Another header file, I presume...
#include <"classA.h">
#include <"classB.h">
Move both includes from here to classB.cpp and add here:
class ClassA;
namespace App
{
public __gc ClassB
{
public:
...

private:
...
ClassA __gc *parentClass;
...
};
}


Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Nimit | last post by:
Hi, I wasn't sure which forum this post belongs to, so I've posted it to a couple forums that I thought may be appropriate. In giving me advice, please consider me a beginner. Below is a synopsis...
3
by: Stan | last post by:
Hallo, I have developed an application in MS Access 2000 (Polish version) under MS Windows XP prof (also Polish). Now I would like to run this code on MS Windows XP EN and MS Access XP EN. I have...
2
by: Matthew Playne | last post by:
Hi, I am having a problem communicating between to classes. I have an MDI application. The parent window contains a mainMenu and a toolbar and toolbuttons, and the child form contains a...
2
by: Wendy Elizabeth | last post by:
I am new to using .net. I am told that I need to setup a config file that will be accessed by a VB.net dll. This vb.net dll will be setup to run every 5 to 10 minutes by a timer that is coded into...
2
by: Paul Bromley | last post by:
Hi, Can someone point me in the right direcion here. I have been a hobbyist programmer for some time with VB6 and am moving to Vb.Net. I am afraid that in the past I did not uderstand too well...
4
by: Greg | last post by:
I've been tasked with writing a small app to that needs to talk to a remote server via raw http. Data is to be sent and received using name-value pairs. I have been given the syntax for various...
2
by: Veleek | last post by:
An alternate title for this might be "Creating my own set of core classes". Just a quick overview. In order to learn C#, Sockets, Multithreading and whatever else I can, I am attempting to...
2
by: Chris | last post by:
Hi, I seem to be having some problems connecting to webservices. I'm running a C# client connected to a Java webservice using GLUE. The difference between the two request and response pairs...
1
by: David Veeneman | last post by:
This posting is for the Google crawler and requires no response. I have created a multi-level object hierarchy, in which the root object needs to be notified whenever any property of any object...
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:
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.