difference between constructors and methods
Constructor:
- constructors must have the same name as the class name and cannot return a value.
- the constructor are called only once per creation of an object while regular methods can be called many times
Ex: For a pet class ,
public Pet()
{
{
}
Method:
- methods can have any name and can be called any number of time
Ex: for a pet class
public void Pet()
{
}