object oriented design principles c#

Want to know object oriented design principles c#? we have a huge selection of object oriented design principles c# information on alibabacloud.com

Effective C + +--inheritance and object-oriented design

the compound Use composite as much as possible Use private inheritance when you need to change a virtual function in the private inheritance base class Another way to override a private inheritance is to change the virtual function by using a compound that defines a nested class that inherits from the public, and the composite class uses that nested object. class Widget {private: class WidgetTimer:public Timer {

Effective C + + Note (vi): Inheritance and object-oriented design

Specify interface inheritance and enforce inheritanceArticle 35: Consider alternatives other than the virtual function。。。。。。。。Article 36: Never redefine inherited non-virtual functionsWhen a non-virtual function in a base class is redefined in a derived class, accessing the Non-virtual function with a pointer to a base class type, which actually points to a derived class object, accesses the Non-virtual function of the base class

C # object-oriented model design 23rd Lecture: startegy policy model (Behavior Model)

(According to the msdn webcast courses) This is a behavior-oriented design model that is widely used. Objects may often need different typesAlgorithm, But if the change is frequent, the type will become very fragile. As shown inCubeTake, take different cross sections, then its area calculation method will be different, need to use different algorithms. So, how can we

Valid C ++ notes: inheritance and object-oriented design

About OOP Blog address: http://www.cnblogs.com/ronny reprint please indicate the source! 1. inheritance can be a single inheritance or multiple inheritance. Each inheritance connection can be public, protected, or private, or virtual or non-virtual. 2. Each option of the member function is virtual, non-virtual, or pure-virtual. 3. Interaction between member functions and other language features: What are the interactions between default parameter values and virtual functions? How does in

C # Object-oriented design-observer mode (17)

event update, type is delegate EventHandler Public EventEventHandler Update; Private stringAction; Public voidNotify () {Update (); } Public stringSubjectstate {Get{returnAction;} Set{action =value;} } } classBoss:subject {//declares an event update, type is delegate EventHandler Public EventEventHandler Update; Private stringAction; Public voidNotify () {Update (); } Public stringSubjectstate {Get{returnAction;} Set{action =value;} } } //colleagues

Effective C + + 6. Inheritance and object-oriented design

-virtual functions specify interface inheritance and enforce inheritance. (as described in clause 33, do not hide non-virtual functions of the base class in a derived class in public inheritance)//Article 38: By compounding the mold out of the has-a or according to something to achieve//clause 39: Use private inheritance wisely and cautiously//1. Private inheritance is highly likely to be an orthodox design strategy when one of the classes needs to ac

C # Object-oriented design--Memo pattern Memento pattern (23)

() {Console.WriteLine ("role Current Status:"); Console.WriteLine ("physical strength: {0}", This. Vit); Console.WriteLine ("damage: {0}", This. ATK); Console.WriteLine ("defensive force: {0}", This. def); Console.WriteLine (""); } //Save Role Status PublicRolestatememento SaveState () {return(NewRolestatememento (Vit, ATK, Def)); } //Restore Role Status Public voidrecoverystate (Rolestatememento memento) { This. Vit =Memento. Vitality; This. ATK =Memen

C # Object-oriented design pattern discussion on--6.prototype prototype mode (creation mode)

Motive (motivation)In software systems, it is often faced with the creation of "some complex objects".These objects often face drastic changes due to changes in demand, but they have a fairly consistent interface. How to deal with this change? How to isolate "these volatile objects" from "Client programs (using these objects)" so that "client programs that rely on these volatile objects" do not change as demand changes.Intentions (Intent)Use the prototype instance to specify the kind of

Objective C ++ part6.inheritance and object-oriented design

32. Make sure public inheritance models "is-a". The so-called optimal design depends on what the system wants to do, including the present and future. The problem to be solved: there are some questions about the locations where both assert passes. Summary: "Public inheritance" means is-. Everything that applies to base classes must also apply to derived classes, because every derived class object is also a

Effective C + +--inheritance and object-oriented design

32. Make sure your public inherits the is-a relationship from the moldPublic inheritance means the relationship of is-a (the principle of the Richter substitution), and every thing that applies to the base class also applies to inheriting classes.The rectangle inherits the square question:-can be implemented with a rectangular operation cannot be implemented with a square-In the field of programming, a square is a rectangle that is wrong-In the real world, a square is a rectangle that is correct

C # Object-oriented design--proxy mode (13)

drops AH with the agent can solve the remote access Problem.Second, the virtual agent, according to the need to create a very expensive object, through it to hold the instantiation of the real object that takes a long time, so as to achieve performance optimization, such as open a large HTML page, there are many text and pictures, those words loaded, but the picture is not loaded, Only see the picture occu

C # object-oriented design model 12th Lecture: flyweight metadata model (Structural Model)

(According to the msdn webcast courses) Object-oriented solution solves the problem of System Abstraction without compromising the system performance. However, in some special applications, because the number of objects is too large, adopting object-oriented will bring an unbearable internal overhead to the system. F

C # Object-oriented design--factory method Model (iii)

(); } }1.3 Client Calls class program { staticvoid Main (string[] args) { new Addfactory (); = operfactory.createoperation (); 1 ; 2 ; double result=oper. GetResult (); Console.WriteLine (result); Console.read (); } }Iv. comparison of simple factory and factory methodsThe client needs to be judged by using a simple factory, such as when the client passes the drop-down list to select

Object-oriented design and object-oriented programming

I have found that object-oriented design is too serious to be overlooked. Use the OOP language, but not object-oriented design. It is nothing more than writing C programs with classes,

C # object-oriented design mode Lecture 3: abstract factory pattern Abstract Factory mode (Creation Mode)

(According to the msdn webcast courses) New Problem: Implementing dependencies cannot cope with changes in the specific instantiation type. (When the instance object changes, it cannot meet the requirements) Example: When a road is prone to change and may become a mudroad, You need to modify all the new to road locations in the system. Solution: Closed change point-where to change and where to close; if the new type is relatively stable, there

C # learning notes for object-oriented design patterns (8)-composite combination patterns (Structural Patterns)

; 2. Decoupling customer code from complex object container structures is the core idea of the composite mode, the Customer Code will be dependent on the pure abstract interface, rather than the complex internal implementation structure of the object container, so as to better "respond to changes ". 3. In composite mode, "add, remove, and other methods related to ob

C # object-oriented design mode Lecture 7: adapter pattern adapter mode (Structural Mode)

According to the msdn webcast courses) Adaptation: basically, the original incompatible interfaces are converted into compatible interfaces without changing the original implementations. Gof: to convert an interface of a class to another interface required by the customer, you have to work together the classes that cannot work together due to incompatibility of the original interface. Object Adapter: Use an existing class as a field of the adapter

C # learning notes for object-oriented design patterns (9)-decorator decoration patterns (Structural Patterns)

();}} /// /// Decoration Class C /// Public Class Decoratorc: decorator{ Public Decoratorc (tank): Base (Tank){} Public Override Void Shot (){ // Satellite Positioning Function Extension // Do shot... Base . Shot ();} Public Override Void Run (){ // Satellite Positioning Function Extension // Do run... Base . Run ();}} Code highlighting produced by Actipro CodeHighlighter (freewar

C # object-oriented design patterns-10. decorator decorative patterns (Structural Patterns) | lecture 10

, there is a problem that cannot be ignored:Explosive growth of subclass! ProblematicRoot Cause: Excessive use of inheritance to extend the object function, because inheritance is a type-introducedStaticSuch expansion lacks flexibility. How to solve the problem: static (compile-time) --> dynamic (runtime) Dynamically add some additional responsibilities to an object. In terms of functions, th

C # object-oriented mode design 22nd Lecture: State state mode (behavior mode)

(According to the msdn webcast courses) Objects in different States often perform different actions. Usually, we can use the switch... Case statement to solve the problem. However, if the state changes frequently, this must cause tight coupling between the object and the object. Of course, we should not deliberately adopt the design pattern to use the

Total Pages: 15 1 .... 9 10 11 12 13 .... 15 Go to: Go

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.