...

View Full Version : C++ equivalent of Java's super.method() ?



Trinithis
10-27-2007, 09:52 PM
What is the C++ equivalent of accessing superclass methods that are overwritten by a subclass?

Java 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++?

Antoniohawk
10-29-2007, 04:42 PM
Maybe the following. I don't know a whole lot about inheritance in C++.


A::println()

Gox
10-30-2007, 02:55 AM
A quick example:


class GameRoot {
...
}

GameRoot is a subclass of SolitaireBase


class SolitaireBase : public GameRoot {
...
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum