Be recorded okay. So in previous lesson we discussed the opening topics and why do you need to go for up x and in a nutshell we understood okay x is a strongly typed object oriented programming language. So why is it O's because it c satisfies all concern like inheritance polymorphism Asterix and intellectualism and I will show you how this C boost features we have explained. How is it doing? inheritance how we can do the inheritance in apics intellectualism and obstruction on polymorphism we'll see that part. Okay.
So before going going to theory bird, let's see how I am going to write a class and to write a class for the things that need to be done. So before the start, if you have any questions, let me know Do you have anything from previous isn't Everything's ok. Ok. So since then we can continue now, when I say class, what does it mean? So simply, I can say, it may be a particular set of applause any class hole in the object oriented programming conserved? point point, somebody said class simply can understood. It's a blueprint.
Okay? Or more generic, I can say. It's a concept. I'll call my technical definition. It's a blueprint or concept of something, which can be a little bit indeed, either the one entity. entity, what does it mean?
Let's see what I'm going to do here. Let's understand what is a class. Okay, let me make it identical for you, sir It is considered. We have something like some land I have. Okay, I have some learned. Okay, we are we all are friends, we have some lands in a good place where I want to build some apartments.
Okay, this is a dependency. Okay. So now what do we need to build some apartments now for making the apartment what we'll do now is we'll do everything with this example to make you understand the concept of class and the concept of object oriented concept. Okay, so now what happens when I want to build an apartment, part two. So first, we'll go to some architect, okay. So the architect will give some kind of blueprint or I can say, some kind of plan, building plan.
We can so I'm going to build England will get okay as we're building The area or the size of Liberia, we are going to get some kind of looping like this. Okay, just consider this is a blueprint okay? But I have okay one on the entrance here okay and the one that back entrance here and that is the in one room one or some kind of blueprint wizard and asked for this plan is what this plan what we have received from an architect. We are going to make the building here. Okay. Now you tell me this blue ring or belief plan plan or do we have received it does this have any physical existence?
It's just in pen and paper. There is no physical existence. This is just a plan or a blueprint of what we're going to build. Am I correct? So, I mean if you got a plan Or marketed, are you going to stay in there? No.
To make this see some legal entity or to make this see and with a understands then we have to construct my home correct? Am I correct? Yes. Okay. So now in this blue screen what we have okay? It will tell Okay, so let's see there is one thing called building plan okay and inside this there will be something like Okay, number of room.
Okay. So square to have a square today here, okay. So what is like what type of color we're going to make the painting what we're going to do, okay? And how we're going to do it this is a commercial idea the behavior like this is a comment on this are going to be better than all the things We're going to make this plan simply this plan but if you see this is just a generic plan what we have version this plan it may be multiple buildings so diamond harbor this one I can read your apartment. Question let's see one is going to build this apartment. Okay?
So say my I'm going to build some commercial area here okay. And Luke is going to be some kind of office area here. Tonight you see this area have some physical existence and we can see what it is one Okay. So now the whenever I say class is nothing but it's just like a blueprint, okay. And the building what we made is nothing but the physical existence of this plan or this blue thing is called if you convert to the CFP decal existence which is going to take some Some kind of location, some kind of location then that we call us this part where we made the physical existence of my planning or time about my blueprint that we call an object. Okay?
So I related it with technical concept how we're going to do it, okay. This is nothing more I can tell my class so class Mockingbird is just a blueprint, okay? Or a conceptual or a concept, which have no physical existence, but when you create an object of it, there is a some kind of physical distance on it. For example, let's go to a very basic example. Okay. Let's see.
I will tell one, one class, okay. person, he pays a person to person, how do we have the person name we know, for some age, we know Okay, first agenda will help. Okay. And then what is going to happen then we'll have a look at what some spillover is here okay some kind of behavior okay let's see. Now, this is a PC This is just a concept a persona is nothing but a contract. So, this person have a no decal existence is just a concept of the things where wherever they can say for instance Am I correct.
So, whenever you say person, there is no physical existence we have, but whenever we say look So, whenever we say devices or models that I can say we have a physical existence. So, if for some we can consider as a class then who are going to object for physical he said nothing What I can say, Okay that is somebody who cares who you person, okay, then somebody See my house with a person? Okay, the locus of a name. Let's have a look at some agenda Look at her particular behavior. Say my man was having all the steps, am I correct? So, plus nothing but you can say it's just a template or blueprint from which we are going to create the object.
In a technical definition we can say, a class or a bird is this template or some blueprint from where we are going to be some object, I mean, correct. Okay, so now, when you say object is nothing but it's exactly one instance of the class an instance So, in this example if you see I have multiple appointments, so instead of numbered one one instance of my plan my building plan correct same way there are multiple persons okay name is location managers who are one instance of this person template or I can say from the person behavior that I can say like this, am I correct for any contingent on this part See, whenever you get any doubt you can stop me You can ask me I want you to have completely fundamental fear and you can you want I want you to be to expert that's my mortal enemy okay.
Whenever you will have any question stop me And so, in this one line definition I understood. So, class is nothing but a blueprint or template. From which we are going to create some real world entity mapping what and what we call that as object that's fine. So, now, whenever I say this person, if you see this if you go to a governor of this building, what do you have? We have number of rules we have square feet we have what kind of colonial to give. So, is this a commercial behavior, this officer behavior or citizen Same way, when it comes to the person template or blueprint class, I can say they have name they have a they have gender and some behavior so, we have like men can go in person can walk or not, that's a waiver of the person correct.
So, now, so every class will be considered we have two different kind of thing to be keep inside the class. Okay, so that means it's class can contain the doctor member is the technically better member and class can contain Like member method will additional party with data member on how we need to create and what is member method will and we'll discuss about this. So simply, in a nutshell we cancer. So class is a blueprint or concert from which we are going to create some real world entity and a class can contain some data member and member methods. Okay, so now financing class can contain data remember how it looks like? And how we can create a class what is the syntax of creating a class we'll see how to create a class for the syntax of building in class.
So whenever I want to create a class what I need to do, so I'll give a concrete syntax of the class then we'll, we'll pass it in the basic level how we're going to understand it. So whenever you are going to write a class always remember you have to use keyword class. Okay, so the competition is going to be my access specifier Hi, this is Paul. Especially I don't know why do we need it okay then we can define some extra properties here I will tell what it is extra properties then we can define with the keyword class we have to the keyword class then you give a class name, it may be a personal and it may billing name it may be purchase order, it may be account batch anything your class name, then my class may implement some interface I will discuss interface for the upcoming sessions for the for the syntax perspective and seeing my class may implement some interface So, what I'm going to keep inside the square record is optional.
Okay. Implement interface so I may not need to implement interface always so if you have written best better fits in line, you will write in future and as you know some some some pitfalls. So, we've given some speaking purpose but I will talk about interpreters Don't worry about recording interface by doing it. Everything okay we may implement an interface okay. We may extend some other class name is nothing but if you see the concept of inheritance if we may extend some other class also, okay, it's also optional, we can make external, other classmates, then you will give the Colibri eight and insert the column record, we may define my data member and my member method to thing okay. So, when I say access specifier, there are multiple assets which we have, which we can say what is the receiver we may have private especially here, let me make a note of everything.
We may have a private as a receiver, we may have public especially fair. I will tell parties as a special Why do we need private we may private public, we may have global access specifier and we may allow the private we in the cell phones to use private public global. So now what's going to happen on this part? So as I specified nothing, but it depends where my class can be accessible. So, where my class can be accessible for now Whatever, let's consider this is my cell for cell phone, okay. So I have in this cell first I have one on a specific time, okay.
And forgiveness was I am going to write one class here, and I want that class can be accessible in any like inside anywhere on this org. Then I can define it as a public associate. So now, anywhere in the namespace, or if you don't have any answers, I can say anywhere in the org If you want your class and the civil Then we can define default public. And if I want that's class or or any data member or member method or job I want that can be accessible only inside defined namespace only entirely defined like that lifecycle then we can subscribe it for example, I have one let me make a diagram diagram for you once again, see why new node not understand stop me and ask me. Okay, let's see, this is my complete org Okay, if I right public, anything in the public then it can be accessible all over here, okay.
But let's see inside this I have defined one class here, okay. And inside this class, I have one more class I have defined as a nested class. I want this masterclass only get visible in this area, then simply I can do You painted as private, okay. And the moment you define anything as global, so it can be assessed anywhere in this or and also outside of this earth. For example, if I want to integrate two different system, let's see I have another system, but I'm going to integrate okay. So I want the class what have defined it can be accessible outside of my all the time we need to define the global.
So that we talked about as the specimen, it did nothing work anywhere in odd and also outside of the Earth can be accessible. Okay, so as additional table we can define private public global. Okay, now you can see any question I'm just starting with very basic concepts. Okay. So thank you. Everything should we start from scratch?
So, based on that we're doing okay. So whenever I'm saying the extra properties what we can define in the class level for our base programming. So now when they say properties, either you can define both john. Okay, yeah, you can define. abstract. You can define with setting you can define without setting.
So these virtual abstract with sharing without setting I'm not going to talk now just to remember these things also we can define in the classroom or in a calm operating system. I will give the definition of each one one by one. Why do we need to be setting why you don't need without setting point we can define virtual and abstract that I will talk in upcoming systems one by one, okay. So then use implements keyword here implements If you have an interface to implement the new Kennedy interface name here or if you want to extend the some class in the class for inheritance propose I can extends class name then inside this I can have data member member method Okay. So now this is a very basic things okay. So whenever we need to use in we will use to interface to be implemented that they will come to Boswell but for now I will give the example of four inheritance on my after some class I will come to our third part, okay, and whenever I'll compress security layer, then I'll talk about my width setting and without sharing.
So now, this point just to remember the keywords okay, but we'll talk about this in detail in the upcoming systems. That's fine. Okay, so now underscore class nothing but it's one template or blueprint from where we can we can create an ideal world entity nothing but object and my class can contain the data member and method on going I want to create a class. I need to Give this as a specific error, then my class class name, then insert the class name, I can have my data member. Let's consider the very basic example if I say, calculator class, okay, the Pacer calculator is a class, let's consider I want to make one class whose name is calculator. So how I am going to define it.
So now nothing but so what we do has to define where my class can. So let's consider this class can be accessible anywhere in the world. So simply I can do public class, then my class name, what is my class name? Let's consider I gave my class numbers but later, I don't want to implement an interface. I don't want to extend any other classes, okay, I do not want to do an inheritance. Simply I wrote public last class and then inside this, I am going to define my data member and member method.
What these are, so when as a data member to be defined, how I'm going to differ in my data member, and how I'm going to define My members, yes. So, my class can contain data member and member method and also it can contain other class. So, you may have heard if not then you will in those conditions I will discuss that also something like a wrapper class or natural class that also we may have one class can contain other class, I will display that but also okay. So, what's going to happen on? Yes, tell me so your data member is nothing but a variable rate that what you're saying, right? Right.
Correct. That's it. Well, I'm coming to that that emotive, very muddy, but that variable, okay, no, that's what mine at a member member method nothing but my methods, my function, okay, that that we can say. So now, so that I never know how I'm going to depend on a member. So if calculator is the class, what are the things going to be a member, data member going to be? My variables, what I'm declaring for a class Like in this si apartment example, it can be a how many number of room I'm going to make, what is my square foot size?
Okay, what is the color I want to give to, and then commercial be able to do these are going to be my methods, my behaviors. So now you can say something behavior, or walk, it's my behaviors, and these are my data members. So how I'm going to do it. So now, when I say data member, so how we're going to build this data member, and part is going to happen or in the more generic terminology, you can say it's like a plus variable. It can be class variable, and also this member method it can say, my class behaviors my class behavior, so how it is going to work on this part. Okay, so now whenever ever saying I want to create a coupler class, then what the things I'm going to build Did that remember and acquire the thing I'm going to be at a class behavior or member method.
Okay, so now, whenever you want to declare a data member for this particular job role, let's see, I want to store two number and I want to do the sum of that. So then a past member is going to be my number one, my secret member is going to be number two, if I say number one, number two, so what I can store here, okay, so one more point to remember class doesn't have any memory allocation, but when you instantiate when you create an object of it, so we allocate some memory to that object, which have which have the physical memory and distance, okay, which will have a physical memory address also. So now, I'm going to define two numbers number one, number two, which I want to add to so in this calculator, I'm giving a behavior. Now teamwork, I am going to do something called Allison.
One mathematical So how I'm going to do it. So now, whenever you want to create a data member, how do you data member data, nothing but my class variables. And when you want to create a new data member, there is your syntax to write that. Let me write the syntax here how we are going to be a data member. Okay. Let's see the syntax then.