We help IT Professionals succeed at work.

how to implement pure virtual function in java ?

eugeneng
eugeneng asked
on
how to implement pure virtual function in java as we can do in c?

class baseclass
{
    protected:
       virtual void Func1()=0;

}

class derivedclass : public baseclass
{
protected:
   void Func1()
   {
      :
   }
}
Comment
Watch Question

Implement an abstract method...
public abstract class Base {

  protected abstract void funk1();

}

public class Derived extends Base {

  protected void funk1() {
    // implementation
  }

}
All methods of an interface are also abstract...
Methods in Java are all virtual (in general).
And "pure virtual" corresponds to "abstract" here - that is, no implementation provided.
Is there something more you'd like to know on this topic?

Author

Commented:
that's great, thanx mate!!