[Solved] Interface vs Abstract Class (general OO)

While your question indicates it’s for “general OO”, it really seems to be focusing on .NET use of these terms. In .NET (similar for Java): interfaces can have no state or implementation a class that implements an interface must provide an implementation of all the methods of that interface abstract classes may contain state (data … Read more

[Solved] Can we create abstract class without abstract method in php? [closed]

An abstract class is a class that cannot be instantiated and must be extended by child classes. Any abstract methods in an abstract class must be implemented by an extending child class (or it must also be abstract). It’s possible to have an abstract class without abstract methods to be implemented; but that’s not particularly … Read more

[Solved] Why can I define only default and static methods inside a java interface? [duplicate]

The reason we have default methods in interfaces is to allow the developers to add new methods to the interfaces without affecting the classes that implements these interfaces. Here is link for complete article. 0 solved Why can I define only default and static methods inside a java interface? [duplicate]

[Solved] Not able to print value of an array while using inheritance in C# [duplicate]

Your PrintDetails() method is printing the array without any kind of formatting (hence it’s just printing the array type) use string.Join to print the array delimenated by commas public override void PrintDetails() { Console.WriteLine(“Hi my name is ” + _name + ” and I am studying ” + string.Join(“,”, _subjects)); } ought to do it. … Read more

[Solved] Need help understanding the output of this code. [closed]

Alright let’s see. First you call Circle9() that starts the constructor: /** No-arg constructor */ public Circle9() { this(1.0); System.out.print(“C”); } As you can see the constructor first calls this(1.0) This means that another constructor is opened and afterwards we print “C” Alright the next Constructor is: public Circle9(double radius) { this(radius, “white”, false); System.out.print(“D”); … Read more

[Solved] Abstract Factory Design Pattern for remote file transfer app [closed]

Since you need to adapt to different mechanics\protocols, you can implement Adapter pattern. Also, adapter can be chosen at runtime, you can also implement Factory pattern to instantiate an adapter. And then Strategy pattern to have adapters and factories. All this being done with IoC to inject dependencies like adapters or factories solved Abstract Factory … Read more

[Solved] Cannot access an Object Reference instantiated by a sibling class

So, blah defines an instance field called label but does not initialise it public abstract class Blah { protected JLabel label; } BlahChildOne initialises the label from Blah public class BlahChildOne extends Blah { public BlahChildOne() { label = new JLabel(); } } BlahChildTwo does not initialises the label from Blah, so it is still … Read more

[Solved] Why we need to implement certain methods when we extend classes in android? [closed]

They are abstract classes/methods and need to be overridden. You can choose to override the functionality or just let it do what the parent classs is doing. An abstract class is a class that is declared abstract—it may or may not include abstract methods. Abstract classes cannot be instantiated, but they can be subclassed. An … Read more