How to make a class protected for inheritance?
I would like to do the same thing I do in Java with the final keyword. I tryed to use const keyword... but it doesn't work. How can I prevent other class to inherit from my class? ...
I would like to do the same thing I do in Java with the final keyword. I tryed to use const keyword... but it doesn't work. How can I prevent other class to inherit from my class? ...
I asked a related question about findbugs, but let's ask a more general question. Suppose that I am working with an object-oriented language in which polymorphism is possible. Suppose that the language supports static type checking (e.g., Java, C++) Suppose that the language does not allow variance in parameters (e.g., Java, again...)...
Why is multiple inheritance considered to be evil while implementing multiple interfaces is not? Especially when once considers that interfaces are simply pure abstract classes? (More or less) duplicate of What is the exact problem with multiple inheritance?, Multiple Inheritance in C#, and some others... ...
I think I am pretty good with programming C# syntax. What I am looking for now is some resources, books(preferable), websites, blogs, that deal with the best way to design object oriented Desktop Applications and Web applications, especially when it comes to data and databases. Thanks ...
Why can't Delphi variants hold objects? More importantly, what's the reason behind this limitation? ...
A lot of times in code on the internet or code from my co-workers I see them creating an Object with just one method which only gets used once in the whole application. Like this: class iOnlyHaveOneMethod{ public function theOneMethod(){ //loads and loads of code, say 100's of lines // but it only gets used once in the who...
I create business applications with heavy database use. Most of the programming work is just to connect components to the database and modifying components to adapt to general interface behaviour. I mostly use Delphi with its rich VCL library, and generally buy components needed. I keep most of the business logic in the database. I rarel...
Premise I believe that there is a way to objectively define "Good" and "Bad" Object-Oriented design techniques and that, as a community we can determine what these are. This is an academic exercise. If done with seriousness and resolve, I believe it can be of great benefit to the community as a whole. The community will benefit by hav...
I'm currently getting through the http://www.cplusplus.com tutorial and I came across this section here: http://www.cplusplus.com/doc/tutorial/inheritance.html that deals with the subject of friend functions and friend classes in C++. My question is, when When is it prudent to use friendship when creating a program? The only clue I g...
I seem to not understand two OOP concepts very well. Could you explain what abstraction and polymorphism are, preferably with real examples and code? Thank you. ...
Lately I've been seeing a lot of talk regarding PHP's lack of late static binding until 5.3. From what I've read proper implementations of stuff like ActiveRecord are not possible until the language has this feature. So, I'm curious about: Which languages do support it, specifically those commonly associated with web development suc...
May be the questions sounds newbie, but I can not distinguish the difference between agregating and holding. What does it mean in terms of, let`s say, C++? I suppose when the object of class A holds (or instantiates) objects of class B, it uses it to perform some functions by itself. For example: class A { int state; public: A(int s...
Say I want to design a database for a community site with blogs, photos, forums etc., one way to do this is to single out the concept of a "post", as a blog entry, a blog comment, a photo, a photo comment, a forum post all can be thought as a post. So, I could potentially have one table named Post [PostID, PostType, Title, Body .... ], ...
I entered this statement in JSLint: var number = new Number(3); And received the following message: Do not use Number as a constructor. Why is that? The statement is creating a number object, not a primitive value, so I don't see why using new is a problem. EDIT: Thanks for all the responses. They've got me thinking further, so...
http://www.amazon.com/Object-Oriented-Thought-Process-Developers-Library/dp/0672330164 Is this book worth reading for a developer who is familiar with OO Programming in C++ and PHP5, but dosen't really get OO? (me) Please also suggest the alternatives you think are better and targeted to similar audience. The book doesn't have be in any...
This is a follow-up question to this one. Take a look at these two examples: var number1 = new Number(3.123); number1 = number1.toFixed(2); alert(number1); var number2 = 3.123; number2 = number2.toFixed(2); alert(number2); I realize they both end up with the same value, but is it correct thinking to refer to a method of a primitiv...
Assume you have some objects which have several fields they can be compared by: public class Person { private String firstName; private String lastName; private String age; /* Constructors */ /* Methods */ } So in this example, when you ask if: a.compareTo(b) > 0 you might be asking if a's last name comes be...
How can instantiated classes access the Document class? Even after I name the Document class using the Properties bar in Flash, attempting to access it from other classes usually fails, saying "attempting to access an undefined property... One solution is always casting the Document class to itself! eg. Main(Main).globalMethod(); Bu...
I was just reading up a lecture which breifly went over Container Interface. I didn't fully comprehend the material and couldn't find too much via google. What I was wondering was, can any of you explain it in real world terms. Also explaining alternatives and when its better to use which? If that is the case. Thanks for any help ...
The question is in the title, why : return double.IsNaN(0.6d) && double.IsNaN(x); Instead of return (0.6d).IsNaN && x.IsNaN; I ask because when implementing custom structs that have a special value with the same meaning as NaN I tend to prefer the second. Additionally the performance of the property is normally better as it avoid ...