Class Member Function Definition

And today we are going to continue the class declarations and number function definition in law station have discussed how to declare array class ok next session I have discussed how to define a Member function ok in C plus plus we can define a Member function into a one is within the class and other one is outside the class when it is defined within the class ke English weekly it becomes inline Member function implicitly it will become inline Member function means it will expanded within the line 2 days the program performance is reduced by because means are generally our program contains Complex statements such as control statements OK when control statements are there in our program inline function expansion gives warning due to this or program performance is reduced that’s why they have given another mechanism called outside the class that means we can define a Member function outside the class also but for that they have given one procedure now what is the procedure before going to start how to define a Member function first of all I going going to give the class declaration now I am going to show you how to prepare the class first for every class we have to start with class cured and later class here by class name is class s t u now I need some data member and member functions iD and him now right now they are data member and one more thing here here observe just there is no private Public Protected keyword OK Here I have not used the private Public Protected access specifier because of in C plus plus the default visibility levels are accessories always private that means now ID and name of what private members now to access Private data who should have to write at least one public Member function now I am going to define a public Member function how public now voice read student next hear what it was red student heated it indicates what listen data type which kind of reading data for returning next function plane here; is this party is called function declaration function declaration which is also called function prototype next now here I want to access this data through the function function declaration completed bracket close now the thing is in function where having 341 is what function declaration second one calling and third one is what definition now we have completed only the function declaration professionalism function declaration next how to define the Member function just before you discuss the different define the function into which one is what within the class and other one is not outside the class how to define a Member function with in the class how I will show you defining a Member function within the class no topic is very simple hair; I am just remove this symbol now remove the; start the programming like this just like this out enter and body soap oscillator I will give you clarity Nexus function header body both are completed within the classmates inside the class now it is called function definition inside the class OK what is the problem with this phone because of when it is defined inside the class it will become inline Member function ok due to that what happened implicit Linux training is conduct in function is expanded as a inline function due to this performance decrease that’s why they are recommending recommending member function outside the class now I will show you how to define a Member function outside the class for this they have given one tax now what is the syntax how to define a Member function outside the class here I am going to show you just for today hostel return type ok and the definition is outside first you have to start plate and type next as usual class name here it is the most important thing as usual we are using function name generally in a function function definition where going to start with functioning but here we should have to start with class name next: : How Cola Cola wishes family with the name scope resolution operator or scope operator now it is called scope resolution operator or scope operator next the function name and any arguments are available then and now the function body it is the syntax to define a Member function outside the class whenever you are going to define a Member function outside the class you should have to follow this send first one return data type letter the class name: : Share calling code call uncle in Hindi function on its right side belongs to the class on its left side OK Here: : India function belongs to this class general scope means what to whom it belongs generally scope meaning is to whom it belongs now it says this function belongs to this class no compiler is getting an idea that is what the function belongs to which class does a compilation directly searching in this class is that it is how to define a Member function outside the class now I am going for practical ok I am going to implement this concept here how to implement this now watch this I am going to do find the number function outside then first of all prototyping by gets closed civil actually this party is called function prototype or function declaration for no the definition is oxide Plus first you have discussion at first you have to go for a return type that hai. Ok. Dysfunction belongs to which class student class that’s why first student class name letter scope operator that I hear now it indicates what this number function which Member function read student read student now the function body the solve this indicates what read student is the member of student class now: : India student is the member of student class but it is a function definition outside the class III for this function calling for this you have to discuss about the object now I am going to start object no series for example here there is a class there is no doubt and how many classes are there only 1 class and it contains 181 name is generally we are calling variables when it is a class where calling data members. I have declared ENT be ok now generally, beer variable and which kind of variables means what integer type variables because of A and B are declared from integer data type I know actually here three integers are there i n t i n t a n t means what a we are the office of IND no 190 virginal copy it is the original copy one of the coffee and is one of the call how many items are there 38 but the point is anywhere in our program because of Chris the original that we should have to create the copy software called integer variable like that here also ok here also having on class now we are not able to directly and how to define a object + Y to define an object first we have to create the class name letter space letter object OK it is the syntax of a object the first class name space object one object and it is how to define the object of a class now suppose here I am going to write main function for example now stay you this is what object what happened when object is defined OK when object is declared the memory is created for example it is our system stack now what happens if he is the copy of student student is having what id and name the sphere ID here name and it takes to bytes memory and it takes 20 words memory because of her ID is integer and name is 20 characters can ok that’s why you are total object size 22 white and they are created with surname yes yes then how to access ID and name Private data thank you for

Speak Your Mind

*