-
April 21st, 2006, 03:34 AM
#1
C++ and states
hi friends
Can we say that class/objects in C++ implicitly supports state based programmming?
Vikrams
-
April 21st, 2006, 03:39 AM
#2
Re: C++ and states
state based programming ???? clarify your question plz
- Sreehari
"Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us."
" Everybody is sent to Earth on a purpose. I am so Lagging behind that i won't die." – Calvin
-
April 21st, 2006, 03:52 AM
#3
Re: C++ and states
well let me explain,
Say I have a class
Class SunLight{
public:
bool state;
void set_state(bool state_value)
{
state=state_value;
}
};
Here I am have function which changes the data member value of my class. So in general I am changing the state of my class.
in C language I can do same using procedure programming but where I need to explicly declare and hold/preserve variables and manuipulate by passing those variables to function.I think this extra burden on programmer.
finally Such kind of implementation can ne implemented as shown above in C++ using classes. So can we say that for state based system my class are useful and efficient, hence the argument "C++ classes implicilty supports state based programming".
Vikrams
-
April 21st, 2006, 04:06 AM
#4
Re: C++ and states
You are correct.
Objects, or classes, can hold a particular state, and, I'm probably sticking my neck out here by saying this, but encapsulation, ie. the parts of the class that you wish to hide from other classes, ideally promotes a state based architecture.
Hope that helps.
I don't mind that you think slowly but I do mind that you are publishing faster than you think. Wolfgang Pauli, physicist, Nobel laureate (1900-1958)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|