The Artima Developer Community
Sponsored Link

Java Answers Forum
Ignore this

2 replies on 1 page. Most recent reply: Nov 2, 2004 2:29 PM by Matt Gerrans

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Senthoorkumaran Punniamoorthy

Posts: 335
Nickname: senthoor
Registered: Mar, 2002

Ignore this Posted: Oct 31, 2004 4:27 AM
Reply to this message Reply
Advertisement
class Base
{
public:
void show()
{ cout << "\nBase";}
};

class Derv1 : public Base
{
public:
void show()
{ cout << "\nDerv1";}
};

class Derv2 : public Base
{
public:
void show()
{ cout << "\nDerv2";}
};

void main()
{
Derv1 dv1;
Derv2 dv2;
Base* ptr;

ptr = &dv1;
ptr->show();

ptr = &dv2;
prt->show();
}


Senthoorkumaran Punniamoorthy

Posts: 335
Nickname: senthoor
Registered: Mar, 2002

Re: Ignore this Posted: Oct 31, 2004 4:31 AM
Reply to this message Reply
class Base{
  public void draw(){
        System.out.println("Drawing Base");
}
}
 
class A extends Base{
	public void draw(){
		System.out.println("Drawing A");
	}
}
 
class B extends Base{
	public void draw(){
		System.out.println("Drawing B");
	}
}
 
public class JavaVirt{
	public static void main (String args[]){
		Base baseA = new A();
		Base baseB = new B();
		baseA.draw();
		baseB.draw(); 
	}
}

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: Ignore this Posted: Nov 2, 2004 2:29 PM
Reply to this message Reply
Conclusion: The java tags are better than the pre tags for code (even it is is not java code, by the way).

Flat View: This topic has 2 replies on 1 page
Topic: about  JCP exam ! Previous Topic   Next Topic Topic: Do Vectors search and remove in log(n) time?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use