English 中文(简体)
私人类别数据
原标题:private class data
  • 时间:2010-09-28 06:34:45
  •  标签:
  • c++
  • stl

您应保留所有数据,但本类职能不属私人部分? 例如: 我有一个 st子:需要进入其他班级的愤怒名单。 你们会怎样振兴它,你真的希望保持其私人性?

<><>Edit>:

I m 寻求个人接触其他类别的每一要素。

最佳回答

真正的问题是,为什么你需要把名单放在另一个类别中。 如果你需要在客户类别中开展具体业务,你可以作出其他选择:

  1. 如果您需要开展明确的工作(例如,计算清单中的平均数值),那么你可以履行这一功能,作为保留清单的类别的成员职能。

  2. 如果你需要履行名单上的所有各类业务,那么你就可以建立一个通用的自动交换器接口,接受各种业务的执行职能或指使者,并退还你需要的任何结果。

这两种选择都不要求你披露名单本身。

问题回答

是的,因为我不想让任何人加以修改,我会把它保留。 然后提供<条码>const_iterators,以便检索<条码>>。

是的,我会将其保留。 既然我们知道某类成员的职能,就能够接触到该类的私人成员,因此不能取代<代码>std:在成员职能中的位置?

如果你需要进入其他几类,那么,你需要创建前一类的物体(通过要求某些成员在该物体上行使职能等),然后称该成员将从事代谢活动。

我是否错过了东西?





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签