<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    常用鏈接

    統計

    最新評論

    Introduction to Objects

    1.The hidden implementation
    The goal of the class creator is to build a class that exposes only what is necessary to the client programmer and keeps everything else hidden. Why?
    (1)Becuase if it is hidden, the client programmer can't access it, which means that the class creator can change the hidden portion at will withou worring about the impact on anyone else.
    (2)The hidden portion usually reprsents the tender insides of an object that could easily be corrupted by a careless or uninformed client programmer, so hiding the implementation reduces program bugs.

    2.Reusing the implementation
    The simplest way to reuse a class is to just use an object of that class directly, but you can also place an object of that class inside a new class. We call this "creating a member object." Your new class can be made up of any mumber and type of other objectss, in any combination that you need to achieve the fuctionality desired in your new class. Because you are composing a new class from existing classes, this conception is called composition. Compositon is often referred to as a "has-a" relationship, as "A car has an engine."
    Because inheritance is so important in OOP, it is often highly emphasized, and the new programmer can get the idea that inheritance should be used everywhere. This can result in awkward and overly complicated designs. Instead, you should first look to composition when creating new classes, since it is simpler and more flexible. If you take this approach,your designer will be cleaner. Once you have had some experience, it will be reasonably obvious when you need inheritance.

    3.Inheritance
    You have two ways to differentiate your new derived class from the original base class.
    The first is quite straightforward: You simply add brand new methods to the derived class. This means that the base class simply didn't as much as you wanted it to, so you added more methods. This simple and primitive use for inheritance is, at times, the perfect solution to your problem. However, you should look closely for the posiblilty that your base class might also need these additional methods. This process of discovery and iteration of your design happens regularly in OOP.
    The second and more important way to differentiate your new class is to change the behavior of an existing base-class method. This is referred to as overriding that method. To override a method, you simply create a new definition for the method in the derived class. You are saying, "I am using the same interface method here, but I want it to do something different for my new type."

    4.Is-a vs. is-like-a relationships

    5.Interchangeable objects with polymorphism

    6The single rooted hierarchy
    All objects have a single rooted hierarchy can be guaranteed to have certain functionality. You know you can perform certain basic operations on every object in your system. All objects can easy be created on the heap, and argument passing is greatly simplified.
    A single rooted hierarchy makes it much easier to implement a garbage collector, which is one of the fundamental improvements of Java over C++. And since information about the type of an object is guaranteed to be in all objects, you'll never end up with an object whose type you cannot determine. This is especially important with system-level operations, such as exception handling, and to allow greater flexibility in programming.

    7.Containers

    8.Parameterized types(generics)
    One of the big changes in Java SE5 is the addition of parameterized types, called generics in java. you will recongize the use of generics by angle brackets with types inside.

    9.Object creation & lifetime
    How can you possibly know when to destroy the objects?
    (1).C++ takes the approach that control of efficiency is the most important issue, so it give the programmer a choice.
    (2).Java, in heap

    10 Exception handling: dealing with errors























    posted on 2008-05-20 13:10 九寶 閱讀(223) 評論(0)  編輯  收藏 所屬分類: Java Study(JavaThinking4)

    主站蜘蛛池模板: 亚洲精品一二三区| 国产三级在线免费观看| 国产自国产自愉自愉免费24区| 四虎影在线永久免费四虎地址8848aa| 曰韩亚洲av人人夜夜澡人人爽| 国产亚洲精品91| 亚洲一级特黄大片无码毛片| 精品乱子伦一区二区三区高清免费播放| 亚洲国产精品成人久久蜜臀 | 亚洲精品乱码久久久久久下载| 亚欧日韩毛片在线看免费网站| 亚洲国产高清在线| 女bbbbxxxx另类亚洲| 亚洲Aⅴ无码一区二区二三区软件 亚洲AⅤ视频一区二区三区 | 久久国产精品免费观看| 国产精品免费视频播放器| 美女视频黄视大全视频免费的| 亚洲av成人一区二区三区在线观看 | 成年女人毛片免费播放视频m| 国产av无码专区亚洲av桃花庵| 亚洲日韩精品国产3区| 日本免费中文字幕在线看| 无码日韩人妻AV一区免费l| 无码高潮少妇毛多水多水免费| 亚洲高清毛片一区二区| 亚洲国产成人精品无码久久久久久综合 | 8090在线观看免费观看| 亚洲av永久无码精品秋霞电影影院| 男女作爱在线播放免费网站| 亚洲国产成人精品无码区在线网站| 国产一精品一AV一免费| 亚洲成a人片在线观看中文app| 久久精品成人免费观看| 亚洲娇小性色xxxx| 国产亚洲精品激情都市| 国产99视频精品免费视频76| 亚洲最新视频在线观看| 久久国产免费观看精品| 一本色道久久88—综合亚洲精品| 亚洲综合色在线观看亚洲| 91九色老熟女免费资源站|