When we create a class or struct, its constructor is called. Constructor will have same name as a class or struct and is usually used to initialize the data members of the new object. There are three types of constructors:
Instance constructors are used to create and initialize any instance member variables when we use new expression to create an object of a class.
Static constructors are used to initialize static data or to perform actions that need to be performed only once. It is called automatically before first instance is created or any of the static members are referenced.
Private constructors are only used when a class contains only static members.
Subscribe to:
Post Comments (Atom)
Call a function in child component from parent component in React
Consider the following parent component class Parent extends React.Component { constructor(props) { super(props); thi...
-
Consider the following parent component class Parent extends React.Component { constructor(props) { super(props); thi...
-
An abstract class cannot be a sealed class because the sealed modifier prevents a class from being inherited and the abstract modifier requi...
-
"Failed to connect to repository : Error performing command: git.exe ls-remote -h https://github.com/narendravenkata/React-Demo.git HE...
No comments:
Post a Comment