+2

//How to call the function "yearOfBirth" person.yearOfBirth //or person.yearOfBirth()

3/24/2020 3:06:05 PM

Ajit Kumar Jena

2 Answers

New Answer

+2

If it is a function, you use parenthesis to call it. If you are assigning it as callback, then you don't use parenthesis.

+3

Considering that person is a reference to an object of a class. You can call it by person.yearOfBirth(); Also you can use the code playground to run and see it for yourself.