程序设计基础(C++) 面向对象程序设计—封装性
1 程序设计基础(C++) 面向对象程序设计——封装性
编程语言的目的 close to the machine close to the problem 摘自《C++语言的设计和演化》 Bjarne Stroustrup
2 编程语言的目的 ◼ close to the machine ◼ close to the problem 摘自《C++语言的设计和演化》 Bjarne Stroustrup
关于C+ Bjarne Stroustrup Be实验室 改进了C 增加了面向对象部分 着重于程序的组织 ■便于描述问题 ANSI C++ 最新版本:htp:// WWw.anslorg/
3 关于C++ ◼ Bjarne Stroustrup ◼ Bell 实验室 ◼ 改进了C ◼ 增加了面向对象部分 ◼ 着重于程序的组织 ◼ 便于描述问题 ◼ ANSI C++ ◼ 最新版本: http://www.ansi.org/
主要内容 面向对象编程思想 C++如何实现封装性 本章小结 本章作业 Ln」
4 主要内容 ◼ 面向对象编程思想 ◼ C++如何实现封装性 ◼ 本章小结 ◼ 本章作业
构造函数和析构函数 class string public String(char*)/构造函数 int length return len; y bool operator>(const String &)i ~ String({ delete[] value}//析构函数 private: int len; char *valuei F;
构造函数和析构函数 class String { public: String(char *);//构造函数 int length(){return len;} bool operator>(const String &); ~String(){ delete [] value;}//析构函数 ...... private: int len; char *value; };