|
What about a feature in an upcoming Delphi version enabling that?
Maybe it could be a compiler switch promoting all private s to strict private s.
... or it could be a feature of the new non-legacy compiler font-end Nick Hodges was talking about. =>...
Started by ulrichb on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
private....
I interpret that as, if codegear is going to change the behaviour of private subclasses can access.
The VCL and RTL makes heavy use that it all works for you .
Classes (or procedural code) to access private members.
|
|
How can i make a methods and data members private in Python? Or doesn't python support private members??
Started by appusajeev on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Python has no concept of protected class methods (accessible only in their... .
Since there is a valid use-case for class-private members (namely underscores, it's private; everything else is public.
And subject to change without notice.
|
|
I know that the derived class can't access the private members of the base class, so why does the derived class inherit the private members of the base class? Is there any case that it is useful?
Thanks!
Started by skydoor on
, 9 posts
by 9 people.
Answer Snippets (Read the full thread at stackoverflow):
The derived class needs the....
So I don't even know what you mean.
The derived class doesn't "inherit" the private members of the base class in any way - it can't of the private members of the base class, for obvious reasons.
|
Ask your Facebook Friends
|
Is there a way to hide private data members of a C++ class away from its users, in the cpp file? I think of the private members as part of the implementation and it seems a little backwards to declare them in the header file.
Started by da_code_monkey on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
There's no way to do partial....
See
http://www.gotw.ca/gotw/024.htm http://www.gotw.ca/gotw/028.htm The classic way to do this is with a proxy pointer to an internal class which implements the functionality .
The "pimpl" idiom is how this is generally handled.
|
|
Is it possible to access private members of a class in c++.
provided you don't have a friend function and You don't have access to the class definition
Started by yesraaj on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Its a bit hacky ;-)
A bit of code to explain this question from ... .
Take a look at this question also: Accessing private members
Well I might be talking rubish to yours in which you can access the private members.
Dangerous.
|
|
I often found myself when writing a new class that inside a class I pass a parameter inside of many private methods. On the other side I also create sometime private members and just use them in one method.
So my question is "After which rules do you ...
Started by nWorx on
, 8 posts
by 8 people.
Answer Snippets (Read the full thread at stackoverflow):
Don't allow' of the class, then use....
If on the other hand be using private class members , using accessors and mutators to access and modify them.
If a parameter is part of the 'state' of the class, then use a private member.
|
|
Is there any reason for the implementation class as used in the pimpl idiom to have any private members at all? The only reason I can really think of is to protect yourself from yourself -- i.e. the private members serve to enforce some kind of contract...
Started by xzqx on
, 8 posts
by 8 people.
Answer Snippets (Read the full thread at stackoverflow):
In fact, I usually declare it as a struct problem in C++: Private....
Why shouldn't it have private members? Just because you're defining one interface as PIMPL doesn't no need for the impl part to have protected/private members.
|
|
I'm having trouble implementing a nested class who's constructor is initialized with some of the enclosing class' private data members.
Example:
Header File: class Enclosing { //...Public members //...Private members int x, int y class Inner; // Declaration...
Started by trikker on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
So, whether you have to do of the Inner class as so:
class Enclosing { private: int x; int y; class Inner { private: int foo; int bar; public: explicit....
Classes should have full access to outer class members (even private ones).
|
|
Hello
I have a situation when I need to access the private members of a class in an embedded private class. How can I do it efficiently.
public partial class Form1 : Form { // this private label will be used only in this form private class MyFormLabel...
Started by serhio on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Of course.
A myFormLabel.Click += label_Click
You can access private members of classes from nested classes.
|
|
Is there a way to generate XML documentation for private members? Be default it only generates it for public members, which is correct for published code but not for code only used within a company.
Started by Jonathan Allen on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Try using GhostDoc ..
It doesn't take much time and also I have found that this approach helps me organize my code structure better .
My advise is to write the xml documentation together with code .
|