|
Hi to all,
namepsace MyNamespace
{
class A
{
public :
void FunA();
};
class B
{
void FunB();
friend void A::FunA();
};
}
Above code compiles successfully.
But below given code generates error as error C2027: use of undefined type 'MyNamespace::B'
Please help me to resolve error in following code?
I am using VC++ 2008.
namepsace MyNamespace
{
class B;
class A
{
void FunA();
friend void B::FunB();
};
class B
{
public :
void FunB();
};
}
Thanks in advance.
Best Regards,
Aniket A. Salunkhe
|
|
|
|
|
|
Hi,
So friend class is the only solution to this?
Thanks & Regards,
Aniket A. Salunkhe
|
|
|
|
|
Aniket Salunkhe wrote: Please help me to resolve error in following code?
At this point, class B is known by the conmpiler, but B::FunB() is not. You can resolve the compiler error by simply replacing the forward declaration of B with the actual definition. Does this go against your design?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: Does that go against your design?
Yes.
|
|
|
|
|
do classes A and B have reciprocal references ?
otherwise, just put each classes into their own header, and include header of class B in header of class A
|
|
|
|
|
Hi,
My code looks like this.
namepsace MyNamespace{
class A
{
int a;
void FunA()
{
a = 10;
}
};
class B
{
int b;
A aObj;
public :
void FunB()
{
aObj.FunA();
}
};
}
Thanks & Regards,
Aniket A. Salunkhe
|
|
|
|
|
HI
Sending onemessage From RTF with BOLD,COLOR fonts to Flash ......But its displaying without BOLD,COLOR in Flash.....but i need display message in flash with BOLD,COLOR fOnt . ..
|
|
|
|
|
Please edit your previous post instead of reposting.
Regards,
Sandip.
|
|
|
|
|
HI
Sending onemessage From RTF with BOLD,COLOR fonts to Flash ......But its displaying without BOLD,COLOR.....but i need with BOLD,COLOR fOnt...
|
|
|
|
|
|
Hello everyone,
1.
Suppose using marshalling to transfer information from one apartment to another apartment, what communication protocol is used? HTTP? TCP? RPC?
2.
Is the communication secure? (Encrypted?)
thanks in advance,
George
|
|
|
|
|
I think you are maybe a bit confused by the term marshalling. It has nothing to do with a specific protocol (it is in fact the opposite: some protocols or technologies use marshalling in order to transmit information). Marshalling is only the action of transforming an object to a data format that can be transmitted or store. See here[^] for more information.
In that sense, there's no such thing as encryption at the marshalling level. On the other hand, the protocol that is using marshalling could also encrypt the transmition, but it is up to the protocol to do that.
|
|
|
|
|
Thanks Cédric,
1.
My current confusion is, I deploy two COM components in two different apartments, and I did not programming any protocol code, I am confused what communication protocol is used. Any ideas?
(As you said, marshalling has nothing to do with protocol, but I also do not program any protocol code. Which party actually implements the communication protocol to transfer object state from one apartment to another apartment?)
2.
I read through the link, my most confusion is what means "record its state and codebase(s)"? What mean codebase here? (looks like the link in Wikipedia for codebase is not good, because it is explained as source codes.)
regards,
George
|
|
|
|
|
Sorry but I'm a bit lost... COM components are (AFAIK) not used for distributed. Are you using DCOM component ? If yes, I can't tell you which protocol is being used. If the components are aimed to be distributed, then they will implemented that themselves I guess.
|
|
|
|
|
Thanks Cédric!
My environment is not using DCOM, but COM out-of -processes server communication or in-process
communication (but in different apartment in both cases), on the same machine. In this environment, I think RPC is used underlying? If yes, does RPC always using TCP?
regards,
George
|
|
|
|
|
George_George wrote: What mean codebase here?
In Java they implemented a mechanism to transfer the codebase for a class to allow remoting of the class without having previously installed the codebase in the remote location. This is part of the Java RMI implementation[^]. The codebase information is basically an address where the bytecode can be downloaded from so that the class can be instantiated.
led mike
|
|
|
|
|
Great led!
In the world of Windows and COM, does the codebase transfer also apply?
regards,
George
|
|
|
|
|
George_George wrote: In the world of Windows and COM, does the codebase transfer also apply?
Yes[^]
led mike
|
|
|
|
|
Hi led mike!
The document you referred said, it is used to -- "Specifies where the common language runtime can find an assembly.". We are talking about marshalling in COM, and I do not think they are related?
regards,
George
|
|
|
|
|
George_George wrote: "Specifies where the common language runtime can find an assembly.". We are talking about marshalling in COM, and I do not think they are related?
That is correct, they are not related. However you posted:
George_George wrote: In the world of Windows and COM
and today you must include the .NET Platform in the "world of Windows". I was unsure of your meaning so I took the broadest interpretation.
In COM the equivalent of CodeBase would be the Registry entries that allow us to use meta-data like CLSID to instantiate the component. I have not worked much with DCOM so I have almost zero knowledge of how DCOM proxies/remoting works. If you are interested you should study the subject.
led mike
|
|
|
|
|
Thanks led,
For .Net and Java samples we discussed before, code base means binary executable file, but peer in COM, I think it should be DLL/EXE COM server, not the CLSID text ID. Any comments?
regards,
George
|
|
|
|
|
George_George wrote: code base means binary executable file
I suppose if we change that to say it "references" the binary module rather than "means" that would be accurate.
My comment was about the Java use of CodeBase as a keyword to provide the meta data containing the address of the binary. That is what would be equivalent to the registry entries and the CLSID parameter in the COM library functions to access the binary module.
Have you discovered yet if DCOM provides some similar remote based feature? Or perhaps it requires the prior installation of the component on each local environment?
led mike
|
|
|
|
|
Thanks led mike,
For automation compatible data types, we only need to let the other party know the type, and they could be able to decode/deserialize.
For the Java, I am not sure if we need to decode/deserialize the content for a type, we need to provide not only the type information, but also the binary executable code?
regards,
George
|
|
|
|
|
George_George wrote: For automation compatible data types, we only need to let the other party know the type, and they could be able to decode/deserial
Sorry George, I don't understand that. Do you have a link to the reference you are getting that from?
George_George wrote: For the Java, I am not sure if we need to decode/deserialize the content for a type, we need to provide not only the type information, but also the binary executable code?
Dynamic code downloading using RMI[^]
One of the most significant capabilities of the JavaTM platform is the ability to dynamically download Java software from any Uniform Resource Locator (URL) to a Java virtual machine* (JVM) running in a separate process, usually on a different physical system.
led mike
|
|
|
|