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

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

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

    常用鏈接

    統(tǒng)計

    最新評論

    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)

    主站蜘蛛池模板: 免费高清在线影片一区| 免费专区丝袜脚调教视频| 亚洲va中文字幕无码| 特级av毛片免费观看| 国产成人亚洲毛片| 免费A级毛片无码专区| 四虎影视免费永久在线观看| 亚洲av午夜福利精品一区人妖| 国产真人无码作爱视频免费| 亚洲国产精品乱码一区二区| 男女午夜24式免费视频| 91在线亚洲精品专区| 中文字幕a∨在线乱码免费看| 国产亚洲av片在线观看18女人| 免费看少妇高潮成人片| 中文字幕亚洲综合久久| 亚洲w码欧洲s码免费| 亚洲乱人伦中文字幕无码| 免费国产精品视频| 91视频免费观看| 亚洲综合精品网站| 日批视频网址免费观看| 亚洲神级电影国语版| 午夜理伦剧场免费| 亚洲女初尝黑人巨高清| 少妇亚洲免费精品| 亚洲精品高清视频| 最近免费中文字幕大全视频 | 高清在线亚洲精品国产二区| 亚洲一级毛片免费在线观看| 蜜桃视频在线观看免费视频网站WWW | 亚洲伦另类中文字幕| 3d动漫精品啪啪一区二区免费| 在线亚洲午夜理论AV大片| 天堂亚洲免费视频| 2022年亚洲午夜一区二区福利 | 亚洲人成在线影院| 国产成人免费高清在线观看 | 久久精品国产大片免费观看| 中文字幕亚洲综合久久综合| 99re热免费精品视频观看|