473,323 Members | 1,550 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,323 software developers and data experts.

object creatiion questions....

Question - I'm defining a class for 2 state machines that are cascaded with
Nid and Vid
definining the 2 state machines. I want to use Nid or
Vid objects in
in the Vid class and Nid in the Nid Class.

What is a way to do this. I've looked at internal class
designation but am not
sure what the best way to do this might be.

Can someone show me an example or take what I've given and
show me what
I need to do.


public class frm
{
public Vid vid;
public Nid nid;

public void frm_load( object sender, EventArgs e)
{
vid = new Vid();
nid = new Nid();
}
}

//
// Class 1 state machine
//

public class Nid
{
InavState navidleState
InavState navwaitState

public Nid()
{
navidleState = new NavIdleState(this);
navwaitState = new NavWaitState(this);
navstate = NavIdleState;
}

public void Idle()
{
navstate.Idle()
}

public INavState NavState
{
set { this.navstate = value; }
get { return this.navstate; }
}

public InavState NavIdleState
{
get { return navidleState; }
}

public InavState NavWaitState
{
get { return navwaitState; }
}

public interface INavState
{
void Idle();
void Start();
}

public class NavIdleState : INavState
{
Nid nid;

public NavIdleState(Nid nid)
{
this.nid = nid;
}

public Idle()
{
nid.NavState = nid.WaitIdleState;
}

public void Start()
{
}
}
}
//
// Class 2 state machine
//
public class Vid
{
IState idleState
IState waitState

public Vid()
{
idleState = new IdleState(this);
waitState = newWaitState(this);
state = NavIdleState;
}

public void Idle()
{
navstate.Idle()
}

public IState State
{
set { this.state = value; }
get { return this.state; }
}

public IState IdleState
{
get { return idleState; }
}

public IState WaitState
{
get { return waitState; }
}

public interface IState
{
void BUp();
void BDown();
}

public class IdleState : IState, INavState
{
Vid vid;
Nid nid;

public IdleState(Vid vid)
{
this.vid = vid;
}

public IdleState(Nid nid)
{
this.nid = nid;
}
public BUp()
{
vid.State = vid.IdleState;
}

public void BDown()
{
vid.State = vid.WaitState;
}
}
}
Sep 12 '06 #1
0 768

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

Similar topics

1
by: sunaina | last post by:
This is the first program I am writing using PHP and Mysql. I am creating a game where user thinks of an object and my program guesses the object while asking series of yes/no questions. All a...
4
by: Tom | last post by:
I want to open a recordset object on an .asp page. When I open the recordset I would like to use a stored procedure that expects a parameter to be passed for the stored procedure. I will then use...
0
by: Craig Rodrigues | last post by:
REQUEST FOR DISCUSSION (RFD) unmoderated group comp.object.corba.tao This is a formal Request For Discussion (RFD) to create comp.object.corba.tao as an unmoderated world-wide Usenet newsgroup...
6
by: stephane | last post by:
I am preparing an exam and I have a copy of last year exam. I answered the first questions and I wander if I am right or wrong. Can someone have a look at the questions and at my answers please?...
5
by: Sunny | last post by:
Hi, I have to implement client/server application. The client have to instaniate an remoting object via http and pass some auth info. If the auth is OK, the client should invoke a method (or...
4
by: Luke Matuszewski | last post by:
Here are some questions that i am interested about and wanted to here an explanation/discussion: 1. (general) Is the objectness in JavaScript was supported from the very first version of it (in...
0
by: rlueneberg | last post by:
I am getting this error when trying to add typed object "Questions" to Arraylist QuestionsList: Object reference not set to an instance of an object. --> r.QuestionsList.Add(q); I tried...
10
by: schneider | last post by:
I'm looking for a way to programaticly call a method from a different object and associate the two objects at runtime. Example: Object A exist and is unknow, I want object B to be able to call a...
4
by: Jess | last post by:
Hello, I tried several books to find out the details of object initialization. Unfortunately, I'm still confused by two specific concepts, namely default-initialization and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.