Click here to Skip to main content
15,850,685 members
Home / Discussions / C#
   

C#

 
GeneralEvaluating expressions Pin
Yaron K.25-Apr-04 21:04
Yaron K.25-Apr-04 21:04 
GeneralRe: Evaluating expressions Pin
Jeff Varszegi25-Apr-04 21:37
professionalJeff Varszegi25-Apr-04 21:37 
GeneralRe: Evaluating expressions Pin
Yaron K.25-Apr-04 21:45
Yaron K.25-Apr-04 21:45 
GeneralRe: Evaluating expressions Pin
Jeff Varszegi25-Apr-04 22:01
professionalJeff Varszegi25-Apr-04 22:01 
GeneralRe: Evaluating expressions Pin
Yaron K.26-Apr-04 2:35
Yaron K.26-Apr-04 2:35 
GeneralRe: Evaluating expressions Pin
Jeff Varszegi25-Apr-04 23:45
professionalJeff Varszegi25-Apr-04 23:45 
GeneralRe: Evaluating expressions Pin
Heath Stewart26-Apr-04 4:13
protectorHeath Stewart26-Apr-04 4:13 
GeneralClass Circular References Pin
Abner Mallidy25-Apr-04 19:40
Abner Mallidy25-Apr-04 19:40 
If I were to have two classes that refer to each other, how do I create them both? Here is an example of what I'm talking about:

test.cs
<br />
namespace yadda<br />
{<br />
    public class A<br />
    {<br />
        public class A()<br />
        {<br />
            ...<br />
        }<br />
        public B MethodForA()<br />
        {<br />
            ...<br />
            return B();<br />
        }<br />
    }<br />
<br />
    public class B<br />
    {<br />
        // Private variables<br />
        private A variable1;<br />
<br />
        public class B()<br />
        {<br />
            ...<br />
        }<br />
    }<br />
}<br />


Notice how classes A and B refer to each other. If I were to do this, there would be a compile error in class A saying more or less that it doesn't know what "B" is. Should I split these classes out into separate class files (.cs)? I don't want to have to make them into separate projects or anything like that.

In C++, I remember being able to create class prototypes, where I could say:
<br />
class A;<br />
class B;<br />
<br />
class A<br />
{<br />
public:<br />
    A()<br />
    {<br />
        ...<br />
    }<br />
    <br />
    B MethodForA()<br />
    {<br />
        ...<br />
    }<br />
};<br />
<br />
class B<br />
{<br />
private:<br />
    A variable1;<br />
public:<br />
    B()<br />
    {<br />
        ...<br />
    }<br />
};<br />


Any ideas? As you might have guessed, I'm still somewhat new to C#. Thanks in advance!
GeneralRe: Class Circular References Pin
Jeff Varszegi25-Apr-04 20:55
professionalJeff Varszegi25-Apr-04 20:55 
Questionhow to draw on a bitmap? Pin
lowiq25-Apr-04 19:08
lowiq25-Apr-04 19:08 
AnswerRe: how to draw on a bitmap? Pin
CWIZO25-Apr-04 22:25
CWIZO25-Apr-04 22:25 
GeneralRe: how to draw on a bitmap? Pin
lowiq25-Apr-04 22:58
lowiq25-Apr-04 22:58 
GeneralRe: how to draw on a bitmap? Pin
Heath Stewart26-Apr-04 4:08
protectorHeath Stewart26-Apr-04 4:08 
GeneralRe: how to draw on a bitmap? Pin
lowiq26-Apr-04 20:48
lowiq26-Apr-04 20:48 
GeneralRe: how to draw on a bitmap? Pin
Heath Stewart27-Apr-04 3:49
protectorHeath Stewart27-Apr-04 3:49 
GeneralRe: how to draw on a bitmap? Pin
lowiq27-Apr-04 4:47
lowiq27-Apr-04 4:47 
GeneralFormula Pin
DucLinh25-Apr-04 16:39
DucLinh25-Apr-04 16:39 
GeneralRe: Formula Pin
Nick Parker25-Apr-04 16:53
protectorNick Parker25-Apr-04 16:53 
GeneralRe: Formula Pin
Werdna25-Apr-04 18:19
Werdna25-Apr-04 18:19 
GeneralRe: question Pin
Nick Parker25-Apr-04 16:39
protectorNick Parker25-Apr-04 16:39 
GeneralRe: question Pin
Steve McLenithan25-Apr-04 17:24
Steve McLenithan25-Apr-04 17:24 
GeneralRe: question Pin
Heath Stewart25-Apr-04 18:52
protectorHeath Stewart25-Apr-04 18:52 
GeneralRe: question Pin
Steve McLenithan26-Apr-04 7:38
Steve McLenithan26-Apr-04 7:38 
GeneralRe: question Pin
Nick Parker25-Apr-04 18:45
protectorNick Parker25-Apr-04 18:45 
GeneralRe: question Pin
osto25-Apr-04 17:53
osto25-Apr-04 17:53 

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.