Back to Browse

C#.Net tutorial in Telugu - Basic Members of a Class - Oops using C# | ottit

420 views
Oct 20, 2022
21:50

#ottit C#.Net tutorial in Telugu - Basic Members of a Class - Oops using C# | ottit Members of a Class: Generally, class contains following members: a. Normal variables (concrete) – a copy of these variables is created for each object. These variables belong to object and created in object memory and accessed to object. b. Class variables(static) – Only one copy is created along with the class. Separate memory is allocated. Shared by all the objects, but does not own to any object. These are called static variables. c. Normal methods – same as normal variables. Accessed by using objectname.methodname() syntax. d. Class methods (static) – can be called as static methods. Accessed by using classname.static method name( ) syntax. e. Constructor. f. Destructor. Constructor: a. It is a special method which contains name same as class name. b. When developer does not provide any constructor, then CLR automatically provides default constructor to the class. If developer provides any customized constructor, then CLR does not provide any default constructor. So that developer must provide default constructor manually. c. It executes automatically when object created. d. It is used to perform initial activities like initializing variables and resource allocation activities. e. In one object’s life time constructor is called only once. f. Explicit calling of Constructor is not allowed. g. For a class we can create more than one constructor. It is called constructor overloading or constructor polymorphism. h. To the constructor we can pass values. i. It must be in public. j. It will not return any value, at the same time specifying void is also not allowed. k. Syntax: public name of the class([………..]) { //statements } l. For static variables initialization we can use static constructor. m. For normal variables we use normal constructor. Destructor: a. It is a special method contains name same as class name. b. It executes at time of object’s memory destruction. c. For a class only one destructor is allowed. d. Destructor can be used to perform resource free activities. e. Passing values to Destructor is not allowed. f. Destructor name is prefixed with tild operator (~). g. Syntax: ~Name of the Class( ) { //statements. }

Download

0 formats

No download links available.

C#.Net tutorial in Telugu - Basic Members of a Class - Oops using C# | ottit | NatokHD