Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Where can I learn to create a programming language?

compilers

This topic has been archived. This means that you cannot reply to this topic.
39 replies to this topic

#37 WingedPanther73

WingedPanther73

    A spammer's worst nightmare

  • Moderator
  • 17757 posts

Posted 03 November 2015 - 08:28 PM

C++ works pretty much the same way, as I recall. I'd have to dig in and do some serious refreshing to be certain, though.


Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/


#38 dargueta

dargueta

    I chown trolls.

  • Moderator
  • 4854 posts

Posted 03 November 2015 - 08:40 PM

How I would define an abstract method (function) in java is that it's a method, that can be declared in an abstract class (not-complete class), with no implementation (without a body; not instantiated) within its declaration that needs to be implemented in a normal class (full class). Once implemented in a full class, any derived / sub-classes do not have to re-implement the method, but they can override it, it's optional though, not necessary.

 

This seems to be the default behavior in Java. In C++ this is called a pure virtual function. Check out the bottom of the post starting at the section titled Pure Virtual Functions in Java.


Edited by dargueta, 03 November 2015 - 08:41 PM.

sudo rm -rf / && echo $'Sanitize your inputs!'


#39 Kreative

Kreative

    CC Newcomer

  • Member
  • PipPip
  • 20 posts

Posted 05 November 2015 - 10:12 AM

This seems to be the default behavior in Java. In C++ this is called a pure virtual function. Check out the bottom of the post starting at the section titled Pure Virtual Functions in Java.

The site says that in Java abstract classes cannot be instantiated, that is not entirely true, you can instantiate an abstract class as long as all abstract methods are given a body within a curly bracket body next to the instantiation. So if you have abstract class called vehicle with abstract method called driveTo(), you can type Vehicle vehicle = new Vehicle() { void driveTo() { /*implementation, giving a body*/ } };

Kind Regards,
Kreative


Edited by Kreative, 05 November 2015 - 10:13 AM.


#40 dargueta

dargueta

    I chown trolls.

  • Moderator
  • 4854 posts

Posted 06 November 2015 - 10:44 PM

Interesting. I've never seen that before. I'm guessing it was introduced after the article was written?


sudo rm -rf / && echo $'Sanitize your inputs!'





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download