How do you call a constructor for a parent class?

How do you call a constructor for a parent class?

How do you call a constructor for a parent class?

View Answers

November 15, 2010 at 2:45 PM

Hi everyone,

You can call parents class constructors by using parent keyword.

Example :

class parent { function __construct(){ // some code } }

class child extends parent { function __construct() { parent::__construct(); // some code } }

Thanks


November 15, 2010 at 2:46 PM

Hi everyone,

You can call parents class constructors by using parent keyword.

Example :

class parent { function __construct(){ // some code } }

class child extends parent { function __construct() { parent::__construct(); // some code } }

Thanks









Related Tutorials/Questions & Answers:
How do you call a constructor for a parent class?
call a constructor
Advertisements
ModuleNotFoundError: No module named 'classh'
ModuleNotFoundError: No module named 'classh'
How do you do data mining projects?
How do you define a constant?
How do you sum a dictionary
Calling Constructor in Spring
Calling Constructor in Spring
How do you pass a variable by value?
how to create a jar file for my packages classs - Struts
How do you add a numerical value to a regex
how do you parse by reference in java(with JGrasp)
How do you master python in a month?
How do you get the size of an array in Python
Are you a self-made data scientist? How did you do it?
How do you map Java Objects with Database tables?
how to call the parent page from child without refreshing the parent and my parent window uses the master page
how to call the parent page from child without refreshing the parent and my parent window uses the master page
how to call the parent page from child without refreshing the parent and my parent window uses the master page
how do i make a phone call from my app without quitting my application
how do you change the message box to a specific color
How do you combine two dictionary values for common keys
How do you make a Jarvis like AI in Python?
What do you mean by Deadlock?
What do you understand by JPA?
in an application one task has to done for every 15 minutes ? How con you do it?
constructor
how to do this?
What do you mean by Serialized?
What do you learn in AI?
Do you need math for AI?
Constructor
how to pass a string from one class to another
How to call servlet in JSP?
What do you mean by docker container
how to call static method
how to call static method
how to call static method
how to call static method
how to call static method
how to call static method
how call ireports in jsp
What do you understand by private, protected and public?
Call the parent page(uses master page) from the child page
Call the parent page(uses master page) from the child page
How to do url rewritting?
What do you understand by Domain Parking?
What do you mean by Read Uncommitted?
What do you understand by Kafka broker

Ads