-
constructors
this is a quick question to anyone that can help. thanks.
is it possible to call a parent constructor from within the child class,
and then overriding the parent constructor with a few more attributes?
// lets say the parent class is People, so i want to use
// the existing n and a to set the veriables in the People class
// and then also add the g variable to the object that is going to
//call this constructor.
class People
{
protected String name;
protected String Age;
People(String n, String a) //People constructor
{
name=n;
Age=a;
}
class Faculty extends People
{
private char g;
Faculty(String n, String a, char g)
{
People(n,a);
Gender=g;
}
// thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|