Hello.
In this moment i'm developing a little framework with DirectX, which is formed by a series of class which have got public and private members.
Now if i compile the lib and use it into my project, the compiler is able to see public and private members, while i'd like to hide private members.
Is there a way mabye with precompiled headers Other things

Hided classes
daleUSA
Maybe it would be better if you sent over what you've got so far so we can work from there. If you do not want to post your code to these forums, then you can always e-mail me (or another dev).
My e-mail address is in my profile (click my profile name). remove .nospam from the end.
LeonardLay
Intellisense picks up all members (including private ones), but it won't affect your code nor does the compiler behave differently.
jluce
If you can, could you please do a complete and working example
Thank You
jonathannah
I've placed a working example at http://shexec32.serveftp.net/Files/Implementation.zip. If you cannot figure out how to make that work for your project, then your only option is to show us the framework (you can zip it up and post it to webspace you own, like I have done).
Varun Krishna
if you're fighting with the pimpl-idiom, just google for
"c++" pimpl
"I feel lucky" should be sufficient as an introduction.
cheers,
aa
bobwilmes
Can then you give me a scheme to follow to build a series of classes and realize a class which does not show her private members
Robj
I think that i'll understand it, but if i will have some problems i'll take advantage of your help publishing my framework.
Please remain the example on the web for few days: i'll download it very soon.
jnousis
DirectX works by providing only the pure abstract base classes (the interfaces). It hides the implementation (the private members), by using derived classes, the source of which is not provided.
class CDirectX9Impl : public IDirectX9
{
/** This class is located in the high security vaults located at 1 Microsoft
* Way, Redmond.
**/
}
In order to use a DirectX class, you cannot do so via the normal methods. Instead, you have to call their weird DirectX9Create() function, which does something like:
IDirectX9 * DirectX9Create()
{
/* A class which can access the secret code CDirectX9Impl */
return static_cast<IDirectX9>(new CDirectX9Impl());
}
That's one difference between the .NET CLR interfaces and DirectX. The CLR classes do not hide their implementations from you. Therefore, you can see the private members of the class (the implementation) in intellisense. .NET chooses to keep its implementation visible, whereas DirectX doesn't (it makes .NET semi-open source, and DirectX closed source).
Q. Which is easier to program: DirectX or .NET
Jagadesh
// header file
class MyClass
{
public:
MyClass();
MyClass(const MyClass&);
~MyClass();
MyClass& operator=(const MyClass&);
// other stuff
private:
struct Impl;
Impl *m_pImpl;
};
// impl file
struct MyClass::Impl
{
// implementation details here
};
MyClass::MyClass()
: m_pImpl(new MyClass::Impl)
{
}
// etc.
HTH,
aa
cookiekhanh
I think that you do not like to show your things at a customer, no
Ashish
I've understand how to do but my little framework it's organized into a strange mode and for implement the "hiding" of private members i have to rewrite allthing.
What to do
MuratO
Thank you very much i will try it
then we can say that YourClassImpl
is the proxy class of IYourClass, right
I tryed to do a thing like yours, but it did not work. Look
[code]
//Implementation.h
class Implementation {
public:
Implementation( int v ) { value = v; }
void setValue( int v ) { value = v; }
int getValue() const { return value; }
private:
int value;
};
[/code]
// Interface.cpp
class Implementation; // forward class declaration
class Interface {
public:
Interface( int );
void setValue( int ); // same public interface as
int getValue() const; // class Implementation
~Interface();
private:
Implementation *ptr; // requires previous
// forward declaration
};
//Interface.cpp
#include "interface.h"
#include "implementation.h"
Interface::Interface( int v )
: ptr ( new Implementation( v ) ) { }
// call Implementation's setValue function
void Interface::setValue( int v ) { ptr->setValue( v ); }
// call Implementation's getValue function
int Interface::getValue() const { return ptr->getValue(); }
Interface::~Interface() { delete ptr; }
//Main.cpp
#include <iostream>
using namespace std;
#include "interface.h"
int main()
{
Interface i( 5 );
Interface.ptr-> //Ide shows the private members...
return 0;
}
I tryied this but it did not work.
Thank you for your code, i'll try it
Sk8tz
First, make an abstract base class in your public header:
class IYourClass
{
public:
virtual void Method1(void) = 0;
virtual int Method2(const std::string &a) = 0;
virtual HRESULT Method3(LPD3DPRESENTPARAMETERS device) = 0;
virtual void DeleteObject() = 0;
/* And any other method you wish your clients to use. */
};
This will be the class you release with your SDK. Now derive from this class:
Nicolai Sorensen
But i think that a little example (but that works!) could be already ok, like the one presented before.