What is an object ?

Object = Entity ;

Object may be

  • -- visible or
  • -- invisible

Object is variable in programming languages.

Objects = Attributes + Services

What is Object-oriented

A way to organize

  • Designs
  • Implementations

Objects send messages

Messages are

  • -Composed by the sender
  • -Interpreted by the receiver
  • -Implemented by methods

Messages

  • May cause receiver to changer state
  • May return results

Object vs. Class

OOP characteristics

  • A program is a bunch of objects telling each other what to do by sending messages.
  • Each object has its own memory made up of other objects
  • Every object has a type.
  • All objects of a particular type can receive the same messages.

The Hidden Implementation

Inner part of an object, data members to present its state, and the actions it takes when messages is rcvd is hidden.

Class creators vs. Client programmers

-keep client programmers' hands off portions they should not touch

-Allow the class creators to change the internal working of the class without worrying about how it will affect the client programmers.

Encapsulation

Bundle data and methods dealing with these data together in an object.

Hide the details of the data and the action.

Restrict only access to the publicized methods.

C plus plus study note (one)的更多相关文章

  1. Beginning Scala study note(9) Scala and Java Interoperability

    1. Translating Java Classes to Scala Classes Example 1: # a class declaration in Java public class B ...

  2. Beginning Scala study note(8) Scala Type System

    1. Unified Type System Scala has a unified type system, enclosed by the type Any at the top of the h ...

  3. Beginning Scala study note(7) Trait

    A trait provides code reusability in Scala by encapsulating method and state and then offing possibi ...

  4. Beginning Scala study note(6) Scala Collections

    Scala's object-oriented collections support mutable and immutable type hierarchies. Also support fun ...

  5. Beginning Scala study note(5) Pattern Matching

    The basic functional cornerstones of Scala: immutable data types, passing of functions as parameters ...

  6. Beginning Scala study note(4) Functional Programming in Scala

    1. Functional programming treats computation as the evaluation of mathematical and avoids state and ...

  7. Beginning Scala study note(3) Object Orientation in Scala

    1. The three principles of OOP are encapsulation(封装性), inheritance(继承性) and polymorphism(多态性). examp ...

  8. Beginning Scala study note(2) Basics of Scala

    1. Variables (1) Three ways to define variables: 1) val refers to define an immutable variable; scal ...

  9. TestNG Study Note 1 - Eclipse 插件安装

    TestNG 插件在线安装 Help -> Install New Software -> Add -> Paste TestNG url to Add:  http://testn ...

  10. CCJ PRML Study Note - Chapter 1.6 : Information Theory

    Chapter 1.6 : Information Theory     Chapter 1.6 : Information Theory Christopher M. Bishop, PRML, C ...

随机推荐

  1. Linux命令的返回码列表

    转自:http://blog.chinaunix.net/uid-10347480-id-3263127.html 在 Linux 下,不管你是启动一个桌面程序也好,还是在控制台下运行命令,所有的程序 ...

  2. webstorm IDE添加Plugins----添加vue插件

    webstorm IDE很强大了,扩展性很强,语法校验很强大,不过有时候一些特殊的插件  还是需要自己添加到IDE的 下面以添加VUE Plugins 为例: Setting--Plugins[点下方 ...

  3. js定义对象的几种容易犯的错误

    //js定义对象的几种容易犯的错误function Person() { getName = function (){ console.info(1); }; return this;}//Perso ...

  4. H5标签--“data自定义数据”

    HTML代码部分: <div id="div1" data-zg="中国人" data-zgr="我们是祖国的儿女,我爱祖国"> ...

  5. Java 枚举类

    如果要定义一个枚举类: public enum Size { SAMLL, MEDIUM, LARGE, EXTRA, EXTRA_LARGE}; 实际上,这个声明定义的类型是一个类,它刚好有4个实例 ...

  6. [Spark] Hello Spark

    这里只使用Spark的Python操作和接口,其他语言应为不熟悉,所以先不写在这里. Spark 部署 可以直接从官方网站下载 pre-build 版本,可以直接在电脑上运行,离线安装也是可以的,比如 ...

  7. 深入了解try catch

    @Test public void testWeiXin(){ System.out.println(task()); } private boolean task(){ try { int i = ...

  8. 关于js的闭包

    http://kb.cnblogs.com/page/110782/ http://www.cnblogs.com/xiaotie/archive/2011/08/03/2126145.html

  9. webpack详细配置讲解

    //常见的Webpack配置文件var webpack = require('webpack');var HtmlWebpackPlugin = require('html-webpack-plugi ...

  10. ahk之路:利用ahk在window7下实现窗口置顶

    操作系统:win7 64位 ahk版本:autohotkey_L1.1.24.03 今天安装了AutoHotkey_1.1.24.03.SciTE.PuloversMacroCreator,重新开始我 ...