| Author: shasia 28 Aug 2008 | Member Level: Silver | Rating: Points: 5 |
constructor is a special method .it is invoked automatically when we create an instance of the class.it does not have any return type. types: Default constructor instance (or)parameterised constructor Static constructor
for ex:
class emp { int i,j; publis emp()//default constructor { i=10; console.writeline(i); }
public emp(int k)//instance { j=k; console.writeline(j); } }
class cmain { public static void Main() { emp e=new emp();//invokes default emp e1=new emp(10);//invokes instance } }
|
| Author: Bindu Bujji 29 Aug 2008 | Member Level: Gold | Rating: Points: 2 |
Refer the below link..
http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=777
Hope this helps Regards
Bindu
|
| Author: UltimateRengan 29 Aug 2008 | Member Level: Diamond | Rating: Points: 5 |
A constructor is a special method for initializing a new instance of a class The constructor method is same name as the class name.A class have more than one constructor. In this case each constructor have same name but different Parameters.
Example:-
public class A { public int x = 0 public int y = 0 public int radius = 0
public A(int x, int y, int radius) { this.x = x; this.y = y; this.radius = radius; } }
1)Copy Construtor 2)paramiterised constructor 3)Dummy constructor 4)Dynamic constructor
|
| Author: Legend 29 Aug 2008 | Member Level: Silver | Rating: Points: 5 |
What is a constructor?
A constructor is a special method for initializing a new instance of a class.
Constructor Example This example shows a class and a constructor named Circle:
public class Circle { public int x = 0; public int y = 0; public int radius = 0; public Circle(int x, int y, int radius) { this.x = x; this.y = y; this.radius = radius; } } A class may have multiple constructors. In this case, each constructor will have the same name, but will have different arguments.
|
| Author: Legend 29 Aug 2008 | Member Level: Silver | Rating: Points: 6 |
Contruction TYPES
1.Primitive type 2.Defined Type
3.2.1. Primitive Types
Only the ASN.1 primitive types INTEGER, OCTET STRING, OBJECT IDENTIFIER, and NULL are permitted. These are sometimes referred to as non-aggregate types.
3.2.1.1. Guidelines for Enumerated INTEGERs If an enumerated INTEGER is listed as an object type, then a named- number having the value 0 shall not be present in the list of enumerations. Use of this value is prohibited.
AND
3.2.3. Defined Types
In addition, new application-wide types may be defined, so long as they resolve into an IMPLICITly defined ASN.1 primitive type, list, table, or some other application-wide type. Initially, few application-wide types are defined. Future memos will no doubt define others once a consensus is reached.
3.2.3.1. NetworkAddress This CHOICE represents an address from one of possibly several protocol families. Currently, only one protocol family, the Internet family, is present in this CHOICE.
3.2.3.2. IpAddress This application-wide type represents a 32-bit internet address. It is represented as an OCTET STRING of length 4, in network byte-order.
When this ASN.1 type is encoded using the ASN.1 basic encoding rules, only the primitive encoding form shall be used.
3.2.3.3. Counter This application-wide type represents a non-negative integer which monotonically increases until it reaches a maximum value, when it wraps around and starts increasing again from zero. This memo specifies a maximum value of 2^32-1 (4294967295 decimal) for counters.
3.2.3.4. Gauge This application-wide type represents a non-negative integer, which may increase or decrease, but which latches at a maximum value. This memo specifies a maximum value of 2^32-1 (4294967295 decimal) for gauges.
3.2.3.5. TimeTicks This application-wide type represents a non-negative integer which counts the time in hundredths of a second since some epoch. When object types are defined in the MIB which use this ASN.1 type, the description of the object type identifies the reference epoch.
3.2.3.6. Opaque This application-wide type supports the capability to pass arbitrary ASN.1 syntax. A value is encoded using the ASN.1 basic rules into a string of octets. This, in turn, is encoded as an OCTET STRING, in effect "double-wrapping" the original ASN.1 value.
Note that a conforming implementation need only be able to accept and recognize opaquely-encoded data. It need not be able to unwrap the data and then interpret its contents.
Further note that by use of the ASN.1 EXTERNAL type, encodings other than ASN.1 may be used in opaquely-encoded data.
OR
Refer the LINK
http://www.astron.nl/aips++/docs/user/gettingstarted/node23.html
|
| Author: Athira Appukuttan 29 Aug 2008 | Member Level: Diamond | Rating: Points: 4 |
Constructor is a member function of the class, with the name of the function being the same as the class name. It also specifies how the object should be initialized.Ways of calling constructor:
1) Implicitly: automatically by complier when an object is created.
2) Calling the constructors explicitly is possible, but it makes the code unverifiable.
|
| Author: Sabu C Alex 29 Aug 2008 | Member Level: Gold | Rating: Points: 5 |
Constructor is a method in a class with the same name as the class. That will not return anything. By default a class can have a default public parameterless constructor. Constructor can be overloaded. Using constructor we can assign values to class variables and properties.
eg:
public class Employee {
public Employee() //Public parameterless constructor {
}
public Employee(String empName) //Public overloaded constructor {
}
private Employee() //Private constructor {
} }
To create an instance of employee class you have to use any of these constructors.
|