This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi Bhaswati, The first choice will give you a compiler error because you are not specifying a method body. The second example will compile and run without any errors. You are specifying a method body but it just doesn't do anything! NOTE: In both your examples, the class Ghost doesn't have to be declared as abstract because no methods inside of it are abstract. Of course, to make your first choice compile you would need to make the haunt method abstract. Regards, Manfred.
When you have a class (that might include real classes), that needs to be subclassed to work. If we for example take the superclass Aminmal. In our example we have to subclasses, Fish and Bird. If we want to implement the method "Move", we realise that the Animal it self has no destinct way of doing this. However both the Fish and the Bird does, as do all other animals. Thus we implement Move() as an abstract method in Anmial thus making sure that all animials have a way of moving. In code this means that if you have a reference of type Animal, the right verion of Move() will be called depending on which instance it refers to. ok? /Mike
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com