implementation

Implementation Strategies for Object Orientation

核能气质少年 提交于 2019-12-10 02:36:37
问题 I'm currently learning Smalltalk in the Squeak environment and I'm reading "Squeak - A Quick Trip To ObjectLand". I enter the object-oriented paradigm with some prior knowledge from Python and Java and this sentence from the book on page 36 has made me think: Smalltalk is a class-based implementation of an object-oriented language. Short sentence but very interesting. In OO all terms like class, object, instance seem to be well-defined and seem to point to the one and only true meaning and

Why do search engines ignore symbols? [closed]

[亡魂溺海] 提交于 2019-12-10 02:29:18
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 8 years ago . Searching for symbols is a common in programming, especially when you are new to a language. For example, I had a question about the :: operator in Python, and that is not searchable. People looking for things like this or Object [] (array of Objects), would not find what they want. Why do search engines seem to

How is inheritance implemented at the memory level?

喜欢而已 提交于 2019-12-10 01:36:48
问题 Suppose I have class A { public: void print(){cout<<"A"; }}; class B: public A { public: void print(){cout<<"B"; }}; class C: public A { }; How is inheritance implemented at the memory level? Does C copy print() code to itself or does it have a pointer to the it that points somewhere in A part of the code? How does the same thing happen when we override the previous definition, for example in B (at the memory level)? 回答1: Compilers are allowed to implement this however they choose. But they

How to check if a template argument is default constructible

时光总嘲笑我的痴心妄想 提交于 2019-12-09 13:17:20
问题 I am writing a template class and want to find out whether template argument is default constructible is there any way to do it ? The code is something like following template <class C> class A { createObj() { C* objPtr = NULL; // If default constructible then create object else let it remain NULL } }; Update: I have tried using code given in this question but it doesn't work, to be precise if return default constructible even for those classes which aren't, I have no idea why is that

SVG 1.1 : What is “user unit” and how to convert user unit into absolute unit(eg: millimeter)?

烂漫一生 提交于 2019-12-09 12:17:25
问题 I am implementing SVG Tiny 1.1 and I am having trouble understanding the "user unit" concept. SVG 1.1 specification defines every <length> with no specified unit (such as "mm", "cm", "pt", etc) to be in "user unit". While implementing interface "SVGLength", I encountered 4 attributes related to the value of the length; value , unityType , valueInSpecifiedUnit , valueAsString . The last 3 attributes are clear enough for me. valueInSpecifiedUnit is in unit type unitType . valueAsString equals

Why is split(' ') trying to be (too) smart?

為{幸葍}努か 提交于 2019-12-09 11:52:26
问题 I just discovered the following odd behavior with String#split : "a\tb c\nd".split => ["a", "b", "c", "d"] "a\tb c\nd".split(' ') => ["a", "b", "c", "d"] "a\tb c\nd".split(/ /) => ["a\tb", "c\nd"] The source (string.c from 2.0.0) is over 200 lines long and contains a passage like this: /* L 5909 */ else if (rb_enc_asciicompat(enc2) == 1) { if (RSTRING_LEN(spat) == 1 && RSTRING_PTR(spat)[0] == ' '){ split_type = awk; } } Later, in the code for the awk split type, the actual argument isn't even

Binary serialization in pure C/C++

醉酒当歌 提交于 2019-12-09 07:12:22
问题 I'd like to implement the binary serialization on my own, without using Boost or any other third-party library. In C++ the simpliest way to achieve it is to use ofstream and then send a binary file over network. But is there any other stream class which I can use as a temporary buffer to avoid writing file to disk? Also, how can I achieve that in pure C? 回答1: Persistence is hard issue. It is not trivial to even serialize an object to disk. Say that, for example, you have a structure like this

What does “implementation-agnostic” mean?

雨燕双飞 提交于 2019-12-09 05:24:39
问题 I'm just wondering what "implementation-agnostic" means? I didn't find any explanation. I mean it in this context: "an implementation-agnostic engineering approach". 回答1: The opposite of "implementation-agnostic" is "implementation-specific". Some examples should make the difference clear: Implementation-agnostic Synonym: Implementation- independent Examples: Sorting algorithm "Quicksort" Algorithms written in pseudo-code The examples above can be implemented with every language (Assembler,

Advice on using modules with Ruby on Rails

僤鯓⒐⒋嵵緔 提交于 2019-12-09 04:55:12
问题 I am using Ruby on Rails 3 and I would know in which case is good to use Modules. I have a controller including a lot of private methods that I use in this way: class UsersController < ApplicationController def update params[:option1] = get_user_option1 params[:option2] = get_user_option2 if params[:option2] params[:saving_success] = update_user end ... if params[:saving_success] flash[:notice] = another_method_1 else flash[:error] = another_method_2 end end private def update_user if params[

Implement common behaviour in alternative to abstract base classes?

懵懂的女人 提交于 2019-12-08 18:30:41
问题 In C#, I have a class hierarchy with a couple of abstract base classes near the top and a fair number of derived classes. A few these concrete classes have some common properties and methods that are implemented identically. It strikes me as wasteful and so one solution might be to implement this common behaviour in another abstract base class. abstract class Control; abstract class SquareControl: Control { public int SquarishProperty; public void SquarishMethod(); }; class Window: