Ask Your Question
2

If there are constants in the parent class, do the child classes inherit them and what is the method of accessing them?

asked 2023-05-06 08:10:42 +0000

lalupa gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-05-06 08:24:01 +0000

david gravatar image

Yes, the child classes inherit constants from the parent class. The method of accessing them depends on the programming language being used. Generally, constants are accessed using the class name followed by the constant name, such as ClassName::CONSTANTNAME in PHP, or ClassName.CONSTANTNAME in Java.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-05-06 08:10:42 +0000

Seen: 14 times

Last updated: May 06 '23