Go Back   CodingForums.com > :: Computing & Sciences > Computer Programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-27-2007, 09:52 PM   PM User | #1
Trinithis
Regular Coder

 
Join Date: Jun 2007
Location: USA
Posts: 527
Thanks: 26
Thanked 74 Times in 72 Posts
Trinithis will become famous soon enough
C++ equivalent of Java's super.method() ?

What is the C++ equivalent of accessing superclass methods that are overwritten by a subclass?

Java code:
Code:
public class A {
   public void println() {
      System.out.println("from A");
}

public class B extends A {
   public void println() {
      super.println();
      System.out.println("from B");
}
How is this done in C++?
Trinithis is offline   Reply With Quote
Old 10-29-2007, 04:42 PM   PM User | #2
Antoniohawk
Senior Coder

 
Join Date: Aug 2002
Location: Kansas City, Kansas
Posts: 1,518
Thanks: 0
Thanked 2 Times in 2 Posts
Antoniohawk will become famous soon enough
Maybe the following. I don't know a whole lot about inheritance in C++.
Code:
A::println()
Antoniohawk is offline   Reply With Quote
Old 10-30-2007, 02:55 AM   PM User | #3
Gox
Regular Coder

 
Gox's Avatar
 
Join Date: May 2006
Location: Ontario, Canada
Posts: 392
Thanks: 2
Thanked 20 Times in 20 Posts
Gox will become famous soon enough
A quick example:
Code:
class GameRoot {
...
}
GameRoot is a subclass of SolitaireBase
Code:
class SolitaireBase : public GameRoot {
...
}
Gox is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:38 PM.


Advertisement
Log in to turn off these ads.