1
vote
2answers
118 views

Should an abstract class always abstract its methods to an interface?

I had learned sometime ago that abstract classes should always abstract their functions to an interface. So instead of having something like this - abstract class a{ public int i; public int ...
-2
votes
1answer
127 views

calling an abstract method in abstract class

Suppose i have an abstract base class Parent which defines an abstract Method A(some parameter) taking a parameter, also it defines an instance Method B which calls method A(parameter) inside its ...
4
votes
4answers
746 views

Which methods should be put in an interface and which in abstract classes?

I have seen many frameworks and modules and their standard they follow is like this UserInterface which have some predefined methods AbstractUserClass which implements userInterface Then ...
5
votes
6answers
4k views

Is there any difference between interfaces and abstract classes that have abstract methods only?

Let's say we have an abstract class and let this class has only abstract methods. Is this abstract class different from an interface that has same methods only? What I am looking to know is if there ...
4
votes
6answers
3k views

What are abstract classes and abstract methods?

I got several explanations but so far I'm not able to understand that what are the abstract classes and methods in Java. Some said it has to do something with the security of the program, other said ...
6
votes
2answers
550 views

Help to understand the abstract factory pattern

I'm learning the 23 design patterns of the GoF. I think I've found a way to understand and simplify how the Abstract Factory works but I would like to know if this is a correct assumption or if I am ...
14
votes
7answers
6k views

What are the roles of singletons, abstract classes and interfaces?

I am studying OOP in C++ and, even though I am aware of the definitions of these 3 concepts, I cannot really realize when or how to use it. Let's use this class for the example: class Person{ ...
2
votes
6answers
504 views

What is the best design decision approach?

I have two classes (named MyFoo1 and MyFoo2) that share some common functionality. So far, it does not seem like I need any polymorphic inheritance but, at this point, I am considering the following ...
16
votes
9answers
17k views

Why should I declare a class as an abstract class?

I know the syntax, rules applied to abstract class and I want know usage of an abstract class Abstract class can not be instantiated directly but can be extended by other class What is the ...