Can someone show me a simple program that will display how to extend and use super?
ceyesuma
-4
Posting Pro
Recommended Answers
Jump to PostHi ceyesuma,
The super method is used to call a parent class's constructor method in the child class's constructor method. As an example...
public class Shape { int height; int width; public Shape() { height = 1; width = 2; } } public class Triangle extends …
Jump to PostSo any child class of Super is going to begin with a height of 1 and width of 2.
You could then add things such as area, volume and other attributes from that base.Could you also change one of the original attributes? Say if I wanted to call Super, …
All 7 Replies
darkagn
315
Veteran Poster
Featured Poster
ceyesuma
-4
Posting Pro
Ezzaral
2,714
Posting Sage
Team Colleague
Featured Poster
no1zson
24
Posting Whiz in Training
Ezzaral
2,714
Posting Sage
Team Colleague
Featured Poster
no1zson
commented:
always helpful
+1
ceyesuma
-4
Posting Pro
no1zson
24
Posting Whiz in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.