Sei sulla pagina 1di 2

Data Types in C# value types(implicit types,struct,enum) reference types(objects) string(implicit in c#) (passed by copy)implicit types in stack (compile time)

processors area (passed by ref)reference types in heap (run time) dynamic memory at the executio n of program garbage collector searches for nonref data in heap during the execution of the program and return to the OS class:simply an abstract model used to define new data types contains data members and operations(methods). Objects:concrete realization or instance built on the model specified by the class. created by the keyword "new" fields: data contained in the class.may be implicit data types,obbjects of some other class,enum,structs. default values methods:are operations performed on the data. inputs some value through it's parameters and return in some data type making an object making a class: class name:Student data: name,age,eng marks,math marks, sc marks total,obtained,percentage methods:calcTotalMarks,calcPercentage,GetPercentage in main: objects:st1 enter value random as u wish call methods:calcTotalMarks,calcPercentage,GetPercentage objects:st2 enter value random as u wish call methods:calcTotalMarks,calcPercentage,GetPercentage print: st1:name - age - percentage st2:name - age - percentage Access Modifiers: restricting access to a particular member private: members only be accessed within the class that contains them protected internal: members only be accessed from the current project or from the type inhe rited from their containg type. internal: can only be accesd from the current project protected: can be accessd from containg class and types inherited from the containg class

public:are not restricted to any one. anyone can see them and access them. default access modifier is private commonly data is private and methods are public namespaces instance members of the class: static members of the class: static members belong to the whole class rather than to individual objec t all the objects of the class will share this. accessed by the name of class not object writeline,readline static methods of console class i.e we call them by class rather than by making object of console class constructor:special kind of method same name as class no return type aoutomatically called when new instance for each object created contains initialization code destructor: method and constructors overloading: possible to have more than on method with the same name and return type but different no of parameters. Inheritance: (reusability)used a module in diffrent application without chang e and a little change (acheived by reducing coupling b/w diff classae) (extensibility) it;s potenial to extend as new need evolve. (acheived by sub-classing,extending it's func Inheritance) base clas:shape derived classes:circle,rectangle,curve

Potrebbero piacerti anche