- 7
- 0
- 约1.29千字
- 约 25页
- 2017-06-10 发布于北京
- 举报
1;2;/**
* A class for simulating an integer memory cell.
*/
class IntCell
{
public:
explicit IntCell( int initialValue = 0 )
: storedValue{ initialValue } { }
int read( ) const
{ return storedValue; }
void write( int x )
{ storedValue = x; }
private:
int storedValue;
};;4;5;6;7;New Features in C++11;int main( )
{
IntCell *m;
m = new IntCell{ 0 };
m-write( 5 );
cout Cell contents: m-read( ) endl;
delete m;
return 0;
}
;int main( )
{
IntCell *m;
m = new IntCell{ 0 };
m-write( 5 );
cout Cell contents: m-re
原创力文档

文档评论(0)