oop
value semantic tricks in C++
Apart from C++ (because he has operator overload), do you know anoth开发者_运维技巧er OOP language that can do (or emulate in the worst case)\"value semantics\" ?In C# if you define your \"object\" as[详细]
2023-04-13 09:22 分类:问答How can I insert an item in the middle of an object in PHP?
If I have a stdClass object like the one below, which has three arrays with non-numeric keys, what\'s the best way to insert another item into the object between my-account and settings?[详细]
2023-04-13 09:16 分类:问答Hiding instance variables of a class
I\'m wondering why Java has this strange behavior regarding a superclass and a subclass having instance variables with the same name.[详细]
2023-04-13 08:32 分类:问答"Base class params are not always used" code smell
Suppose you had such code: public Base { abstract void Register(); } public Registrator1: Base { override void Register()[详细]
2023-04-13 07:20 分类:问答Holding out on object creation
Is there ever a case where holding the necessary data to create an object and only creating it when is absolutely necessary, is better/more efficient than holding the object itself?[详细]
2023-04-13 06:36 分类:问答Use of self = [super init] in custom init method of NSObject subclass
I am subclassing NSObject @interface MyClass : NSObject { } -(id)customInit; @end and implementing a custom init method in it,[详细]
2023-04-13 05:40 分类:问答Using a Builder class to recreate child object set using DI?
I have a Request class that is used to retrieve a file resource from an external process, using a method R开发者_运维技巧etrieveResource(). This method takes approximately 10-15 seconds to complete. I[详细]
2023-04-13 04:25 分类:问答Sending a message between 2 objects
I have objects A and B that need to send and receive开发者_运维技巧 messages from each other. For example:[详细]
2023-04-13 03:39 分类:问答Why can't a class have same name for a function and a data member?
Why can\'t a c++ class have same name for a function and adata member? class demo{ public: int size(); private:[详细]
2023-04-13 03:10 分类:问答A concrete design case in C++, embedded AVR project
I have a design problem I pictured on a diagram below. There is a class Owner holding pointers to classes Switcher and Base. Switcher has a method, say Switcher::switch(Base* base) whose goal is to ch[详细]
2023-04-13 02:52 分类:问答