|
If I have a class A, I can also create a class within it called B. Is there any practical use for this? To illustrate my question I will give an example.
<br />
class A<br />
{<br />
int m_nMemberOfA;<br />
<br />
class B<br />
{<br />
public:<br />
void MethodOfB();<br />
};<br />
};<br />
<br />
...<br />
<br />
void A::B::MethodOfB()<br />
{<br />
...<br />
}<br />
Can B gain access to the member variables of A or anything like that without having to pass the "this" pointer?
Thanks in advance,
Clint
|
|
|
|
|
clintsinger wrote:
Can B gain access to the member variables of A or anything like that without having to pass the "this" pointer?
No, of course not. What would happen if they both had an int called a ?
You'd encapsulate one class within another if it existed solely as a helper for that class, if only class A had a need to create instances of class B. Then you could make it private or protected in class A, and control the fact that only class A could make them.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
I think your question is, are nested classes in C++ like inner classes in Java? The answer is no. Offhand, I'd say they are much like static nested classes in Java.
The purpose of nested classes is to express scoping of names.
|
|
|
|
|
Does anyone know how to write data to cd-r drives using IoControl codes in the platform sdk??
|
|
|
|
|
The fact that several expensive SDK's exist to do this suggests to me that it is not an easy task.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
Check out the Image Mastering API (IMAPI)
available now under WinXP.
|
|
|
|
|
Was going to use that but it only works on XP not 2000/me/98 etc..
Thanks
|
|
|
|
|
Why have you asked this question three times ?
I'm fairly sure there is an example on the site. The app wizard also creates an app with one splitter, it should not be hard to increase the count to support four views, I would think.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
I also try to find this on the site, but I can't got it. Could you mind tell me where can i find it?
|
|
|
|
|
I dunno, I thought I'd seen it. Maybe it was in MSDN.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
hello Everybody,
I am working on a project involving PCs as peer sensors on a network. The sensor can use ccd cameras (microscops), can process acquired images, can replicate data on an overlay network (P2P), can distribute processing (actually start, control and stop them remotely).
I'd like to create a object-oriented, component-oriented "generic" framework in C++... for sensors in general and for my application in particular. Also, I'd like to have some functionalities (Input, Processing, Networking...), as independent components, i.e. that can be used without the others (separate DLLs?).
Sensor Component
|
|- Input Component
|
|- Processing Component
|
|- Networking Component
|
|- Coordinator Component
MySensor Component : inherited from Sensor Component
|
|- Vision Component : inherited from Input Component
|
|- MyProcessing : inherited from Processing Component
|
|- P2P : inherited from Networking Component
|
|- MyCoordinator : inherited from Coordinator Component
How do I make such a framework? What tools are the easiest?
Where should I start?
Should I buy a book "creating our own framework for dummies"?
Any comments are welcome!!
Thanks a lot!
Bertrand Boichon
Research Assistant
Electrical & Computer Engr.
Oregon State University
|
|
|
|
|
Anonymous wrote:
I'd like to create a object-oriented, component-oriented "generic" framework in C++...
Your description suggests a class library, not the framework. What exactly do you mean by 'generic'? 'Generic' as in 'generic programming'?
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
I want to ask how to display four view at the same time(i.e. splitting), each views are come from different class?? (e.g view1, view2 view 3, view4)
|
|
|
|
|
You want to display in 2x2 or 4x1 or 1x4??
Weiye, Chen
When pursuing your dreams, don't forget to enjoy your life...
|
|
|
|
|
i WANT TO DISPLAY 2X2
THX!!!
|
|
|
|
|
Then you can try this
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT ,<br />
CCreateContext* pContext)<br />
{<br />
if (m_wndSplitter.CreateStatic(this, 2, 2) == FALSE)<br />
return FALSE;<br />
<br />
if (m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CView1), CSize(100, 100), pContext) == FALSE ||<br />
m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CView2), CSize(100, 100), pContext) == FALSE ||<br />
m_wndSplitter.CreateView(1, 0, RUNTIME_CLASS(CView3), CSize(100, 100), pContext) == FALSE ||<br />
m_wndSplitter.CreateView(1, 1, RUNTIME_CLASS(CView4), CSize(100, 100), pContext) == FALSE)<br />
return FALSE;<br />
<br />
return TRUE;<br />
}
Weiye, Chen
When pursuing your dreams, don't forget to enjoy your life...
|
|
|
|
|
Thx you very much!!!
But when I execute it
it tell me
CView1 is not a class or namespace name
classCView1: undeclared identifier
CView2 is not a class or namespace name
classCView2: undeclared identifier
CView3 is not a class or namespace name
classCView3: undeclared identifier
CView4 is not a class or namespace name
classCView4: undeclared identifier
How can I solve it?
Sorry for I have many question!!!
|
|
|
|
|
CView1, CView2, ... CView4 are your 4 different views that you need to create. You need to replace them with the actual names of those view classes you created.
Weiye, Chen
When pursuing your dreams, don't forget to enjoy your life...
|
|
|
|
|
OK
Thx you very much!!!
I know how to do it right now^V^
|
|
|
|
|
How to add a scroll bar in CView? (MDI APP)
|
|
|
|
|
Derive from CScrollView instead.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
But my existing program are come from CView, how to modify it?
thx!!!
|
|
|
|
|
You cunningly place your cursor between the C and the View and type S-c-r-o-l-l. Seriously, you just need to derive your existing view from CScrollView instead, which means a few changes in the .h and .cpp file, and it will work. Look up CScrollView in the MSDN, I forget how to set the scrollable area off the top of my head.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
I also use this tricky method before.
But when I execute it, even there is no error and warning are detected.
The program will terminated when I open a new file. I dont know why
THX!!!
|
|
|
|
|
I am attempting to load an XML file using the DOMDocument 'load' method of the MSXML parser but it does not seem to be validating the file against the schema. The document will load ok and is even checked for correct XML syntax but doesn't validate against the schema.
Here is an outline of the code:
#import "msxml3.dll"
IXMLDOMDocumentPtr spDoc;
hr = spDoc.CreateInstance(__uuidof(DOMDocument));
if (FAILED(hr))
{
return 0;
}
// These properties are supposed to be set by default
// but just in case I make sure they are.
hr = spDoc->put_resolveExternals(VARIANT_TRUE);
if (FAILED(hr))
{
return 0;
}
hr = spDoc->put_validateOnParse(VARIANT_TRUE);
if (FAILED(hr))
{
return 0;
}
// Load and parse the input XML file.
_variant_t vFile(lpszXMLFile);
VARIANT_BOOL bSuccess = false;
hr = spDoc->load(vFile, &bSuccess);
if (FAILED(hr) || !bSuccess)
{
return 0;
}
The reference to the schema in the input XML file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<FreshItem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\Visual Studio Projects\Wcpw\Debug\FreshItem.xsd">
I suspect it is something to do with the reference to the schema since if I edit this to put in some bogus path it will still succeed to load, it looks like it is ignoring the schema reference altogether.
|
|
|
|