Classes, Public and Private access modifiers in C++ | C++ Tutorials for Beginners #21

Поділитися
Вставка
  • Опубліковано 18 гру 2024

КОМЕНТАРІ • 1 тис.

  • @blackopss017
    @blackopss017 2 роки тому +332

    #include
    using namespace std;
    //Structure of class
    class Animal{

    //Private variables accessible only with the help of function.
    private:
    int leg, eyes, ears;
    public:
    int sound, speed;
    void setData(int a1, int b1, int c1); // Declaration only
    void getData()
    {
    cout

    • @FB_TECHS
      @FB_TECHS Рік тому +10

      same as harry 🤣 good

    • @vedantkokate82
      @vedantkokate82 Рік тому +5

      Well try

    • @ArPiTNooB
      @ArPiTNooB Рік тому +2

      😁👍

    • @julfekar7564
      @julfekar7564 9 місяців тому +7

      Sound ko bhi integer data type me rakha hai
      Sound ko string ya character data type me rakhna chahiye tha

    • @Bloodflood
      @Bloodflood 5 місяців тому +5

      #include
      using namespace std;
      class animals{
      private:
      int eyes;
      int legs;
      int ears;
      public:
      int speed;
      int voice;
      void setdata(int a, int b, int c){
      eyes=a;
      legs=b;
      ears=c;
      }
      void getdata(){
      cout

  • @imgullu
    @imgullu 2 роки тому +269

    Time Stamp - 14:59
    #include
    using namespace std;
    class Students
    {
    private:
    int roll_no;
    string religion;
    public:
    string f_name;
    int standard;
    int age;
    void setData(int r, string rel); // r stands for roll_no & rel stands for religion.
    void getData()
    {
    cout

    • @rajrai4294
      @rajrai4294 2 роки тому +22

      Thanks Gulshan you given me best example of classes and object

    • @imgullu
      @imgullu 2 роки тому +11

      @@rajrai4294 Your Welcome 🤝🏻

    • @curiousritik4558
      @curiousritik4558 2 роки тому +6

      Syntax error aayega brother 🙂

    • @rajrai4294
      @rajrai4294 2 роки тому +23

      @@curiousritik4558 Bhai coding line me aaye ho syntax error ho ya koi bhi error ho wo toh tumko hi solve krna h
      Dhyaan do toh sirf logic pe
      Yha gulshan ne kitne badhiya logic se ye problem likha h

    • @curiousritik4558
      @curiousritik4558 2 роки тому +2

      @@rajrai4294 accha

  • @nikhilsrivastava311
    @nikhilsrivastava311 4 роки тому +395

    #include
    #include
    using namespace std;
    class Student{
    private:
    int roll;
    public:
    string name;
    int Class;
    void setData(int r);// declared
    void getData(){
    cout

    • @laxus7764
      @laxus7764 3 роки тому +9

      @Felix Enzo I've seen you commenting exactly like this in some other video as well...wtf boy

    • @swaroop2518
      @swaroop2518 3 роки тому +14

      @Felix Enzo don't promote your stuff here like this, because 99% of people here don't have Gf.

    • @Pianissimo311
      @Pianissimo311 3 роки тому +4

      hmm, helps in understanding better... thanks 😃👌👏👏

    • @goodcake05
      @goodcake05 3 роки тому +1

      @@swaroop2518 That hurts 😂

    • @cse080chandrasekhar9
      @cse080chandrasekhar9 3 роки тому

      @@swaroop2518 hahaa

  • @sandeep_cse_3231
    @sandeep_cse_3231 4 роки тому +15

    class bank
    {
    private : float transection, loan;
    public : int profit, loss;
    } ;

  • @mystudiobeats8440
    @mystudiobeats8440 4 роки тому +18

    You are the best Harry Bhai ...free online course provider ....😍🥰🥰

  • @devanshusahoo
    @devanshusahoo 2 роки тому +14

    #include
    using namespace std;
    class animal{
    private:
    int age,height,length;
    public:
    string name,species;
    void setdata(int a,int h, int l); //note:a,h,l are just 3 random variables we have used to signify that we will be using 3 integers.
    void getdata(){
    cout

  • @kumarrajneesh2321
    @kumarrajneesh2321 4 роки тому +15

    Bahut achha lga mujhe, and concept are so easy to understand by watching it. 💯

  • @theevi1350
    @theevi1350 4 роки тому +5

    Thanks Harry Bhai...
    Kuch smjh ni aa rha tha aaj jake sara kuch clear hua hai ...

  • @aiexplorations-cv1js
    @aiexplorations-cv1js Рік тому +17

    Coded Myself time : 14:50
    #include
    #include
    using namespace std;
    class animal{
    private:
    char gender;
    int babbies;
    public:
    char name[50];
    int legs;
    int hands;
    void setData(char, int);
    void getData();
    };
    void animal :: setData(char gen, int bab){
    gender = gen;
    babbies = bab;
    }
    void animal :: getData(){
    cout

    • @jivangaming
      @jivangaming Рік тому +2

      Nice code bro 👍

    • @shreyamittal9152
      @shreyamittal9152 Рік тому +1

      would you please tell me, what is the use of strcpy(); ?

    • @aiexplorations-cv1js
      @aiexplorations-cv1js Рік тому +1

      @@shreyamittal9152Strcpy(String Copy) function, is use to copy string into a variable.

  • @nafisahmed3607
    @nafisahmed3607 3 роки тому +6

    Love from Bangladesh Harry Bhai 🇧🇩🇧🇩❤️
    14:45
    Here,the example of a class is car
    It can have different properties like
    - Brand
    - Color
    - Transmission
    - Mileage

  • @30vaibhavdhaygondexdr.v.sa22
    @30vaibhavdhaygondexdr.v.sa22 4 роки тому +9

    // Class 15:00
    class Program{
    private:
    int age;
    char qualification;
    public:
    char languages;
    int projects_made;
    int time_experience; // --> write this in years;
    }

  • @AmirNiazi007
    @AmirNiazi007 Рік тому +82

    I got 88% marks in my midterm exam due to this playlist hoping best for the final....
    Thanks ❤

  • @dipesh-singla
    @dipesh-singla 4 роки тому +15

    Bro ur video are amazing outstanding but my exams are near kindly complete the course asap

  • @AmarKumar-iz8gy
    @AmarKumar-iz8gy Рік тому +3

    the answer i was searching that why classes is used instead of structure is well explained here .

  • @almasnazakat4363
    @almasnazakat4363 3 роки тому +17

    Q 1: Write a C++ function “addition” that will take two arguments “istVal” and “secVal” as integer
    arguments and the function will add the values of “istVal” and “secVal” and return the result to
    the calling statement in main function.

    • @usamasharjeel8532
      @usamasharjeel8532 3 роки тому +2

      itna easy aap cmt me q puch rhi ho

    • @prernaprerna4028
      @prernaprerna4028 2 роки тому +2

      @@usamasharjeel8532 for answer 😅🙃

    • @rpw2k23
      @rpw2k23 2 роки тому +3

      @@prernaprerna4028 first time ⌚ sab kuch hard lagta hain 🙃🙃😕

    • @vritikapathare
      @vritikapathare 2 роки тому +17

      #include
      using namespace std;
      class Sum{
      public: int sum;
      int add(int istVal, int secVal);
      };
      int Sum :: add(int istVal, int secVal){
      sum= istVal + secVal;
      return sum;
      }
      int main(){
      Sum s;
      cout

    • @sumitraj6878
      @sumitraj6878 2 роки тому

      @@vritikapathare noice

  • @Anurag-fk3op
    @Anurag-fk3op Рік тому

    Class avengers{
    Public:
    Int speed;
    Int health;
    Int fire;
    Void attack() {
    Int attack=speed+fire;
    Cout

  • @jersingh6837
    @jersingh6837 Рік тому +4

    Thanks Harry bhaiya ji for this amazing course that is free of cost!

  • @a_12_nileshchaudhari14
    @a_12_nileshchaudhari14 3 роки тому +4

    Don't know only few view of this outstanding lecture

  • @sufiyanmogal1527
    @sufiyanmogal1527 2 роки тому +10

    Time Stamp - 14:50
    #include
    using namespace std;
    class animal
    {
    private:
    string Name;
    string food;
    public:
    int legs;
    int lifespan;
    void setData(string a,string f);
    void getData(){
    cout

    • @uditmehra5636
      @uditmehra5636 2 роки тому +2

      Enter the name of the animal
      Dog
      Enter the favourite food
      Biscuits
      How many legs they have
      4
      What is lifespan of dog
      20
      The name of the animal is dog
      Loves to eat biscuits
      Dog has 4 leags
      The lifespan of dog is 20 Years

    • @sufiyanmogal1527
      @sufiyanmogal1527 2 роки тому +2

      @@uditmehra5636 thanks bro for showing the output of the code

    • @myth_snipe7737
      @myth_snipe7737 Рік тому

      string requires header file right?

    • @sufiyanmogal1527
      @sufiyanmogal1527 Рік тому

      ​​​@@myth_snipe7737no its not required you can define string variables in c++ if you want to use string functions than the string.h header file required

    • @sufiyanmogal1527
      @sufiyanmogal1527 Рік тому

      ​@@unknownking798most welcome bro ❤

  • @rajmanipandey3999
    @rajmanipandey3999 Рік тому +1

    Main pichle 5 dino se aise languages doondh raha tha jo bahut tuff ho sikhne mein time lage baad mein mujhe mili c++ bhai ne use bhi easy bana diya 😢rona aa raha hai

  • @manmeetsinghkhalsa2077
    @manmeetsinghkhalsa2077 2 роки тому +7

    you might be earning good ....
    but here you are earning the blessings and good wishes of all struggling students who were looted by the paid training goons after expensive degree expanses and the poeple looted on the name of internship ....god bless. u dear .....keep it up

  • @saurabhpandey2018
    @saurabhpandey2018 3 роки тому +16

    This tut boosted my confidence ❤❤

  • @LokeshSharma-hm5jz
    @LokeshSharma-hm5jz 2 роки тому +25

    short and to the point. Your videos saved a lot of time ..... Thanks for making such a great content......

  • @swarajsundar4520
    @swarajsundar4520 3 роки тому

    Thanks

  • @kaminijain5544
    @kaminijain5544 2 роки тому +9

    14:55
    #include
    using namespace std;
    class animal{
    private:
    int areanum;
    int sellingvalue;
    public:
    int population;
    int speed;
    void setdata(int sellingvalue,int areanum);
    void getdata(){
    cout

  • @RahulRahul-qj5bv
    @RahulRahul-qj5bv Рік тому +1

    you made me poor to better coder.
    Thank you harry bhai .... love you bhai

  • @vikrantgodbole1181
    @vikrantgodbole1181 2 роки тому +72

    # include
    using namespace std;
    class animal{
    private:
    int love;
    public:
    int sound;
    int legs;
    void setdata(int a);
    void showdata(){
    cout

  • @surendrakashyap4859
    @surendrakashyap4859 4 роки тому +18

    Very good sir.....
    Ek request hai plzz data structures par bhi tutorial video bnaye.

  • @umarafzal8009
    @umarafzal8009 10 місяців тому +1

    you are the best teacher in the world

  • @pulastyabhagwat7774
    @pulastyabhagwat7774 Рік тому +4

    Time Stamp - 14:59
    //Written By Pulastya
    #include
    using namespace std;
    class Car{
    private:
    double cost_of_car;int dis,rto_num;
    public:
    string name; int model_num;
    void setData(int a1,int b1,int c1);
    void getData(){
    cout

  • @irfanmohammad2132
    @irfanmohammad2132 Рік тому

    hey harry!
    #include
    using namespace std;
    class animal
    {
    public :
    string name,food;
    void hello(string name,string food);
    };
    void animal :: hello(string name,string food){
    cout

  • @defencofinishers3276
    @defencofinishers3276 3 роки тому +6

    after watching lot of videos finally , i got the right one

  • @cod-phy1646
    @cod-phy1646 3 роки тому +23

    Wonderful way of teaching...thanks harry bhaiya❤️

  • @AzeemKhan-sr4my
    @AzeemKhan-sr4my 4 роки тому +16

    Hello kindly c++ kai projects bhi bananna jis tara python kai app nai banye the..... Jis mai sare c++ kai topics covers hojay.... Make projects for c++.
    Thank u.

  • @piyushdixit6353
    @piyushdixit6353 4 роки тому +99

    Heyy Sir make more videos as soon as possible..my exams will start from mid of march

  • @taleofkaran
    @taleofkaran 4 роки тому +98

    Mid Sem Tests coming soon.. Please upload more videos soon. I've watched C playlist already. By the way, I love your content.

    • @dattpostariya8402
      @dattpostariya8402 4 роки тому +5

      Yaar meri bhi

    • @dattpostariya8402
      @dattpostariya8402 4 роки тому +5

      Midsam is very very soon

    • @tasneemahmad7858
      @tasneemahmad7858 4 роки тому +8

      padhai likhai pr dhyan do
      IAS YAS bano aur desh sambhalo

    • @uraniumgaming123
      @uraniumgaming123 3 роки тому +2

      @@tasneemahmad7858 wah bhai roll numer hi lagaliya name me ?

    • @tasneemahmad7858
      @tasneemahmad7858 3 роки тому +4

      @@uraniumgaming123 college walo ko google meet pr naam me yahi pattern chahiye

  • @sumanjain957
    @sumanjain957 Рік тому +4

    learning java was so damn helpful, it was a piece of cake!

  • @AbdullahKhan-hu8fo
    @AbdullahKhan-hu8fo Рік тому +2

    Great explanation.your effort is awesome

  • @__ajaymath6585
    @__ajaymath6585 2 роки тому +17

    challanged accepted sir ,
    and your way of teaching is really very good , videos are short but cover every point of the topic . really very helpfull to learn C++ .
    thank you sir
    😊

  • @suhashisumanshukla2779
    @suhashisumanshukla2779 4 роки тому +8

    class Room
    {
    public:
    double length;
    double breadth;
    double height;
    double calculateArea(){
    return length * breadth;
    } double calculateVolume(){
    return length * breadth * height; }
    };

    • @Gangbuster74
      @Gangbuster74 4 роки тому

      why you are defining your area function here, its very hard to read here,

    • @shikhargupta8759
      @shikhargupta8759 4 роки тому

      Where is private keyword???

  • @skillslogo
    @skillslogo 2 роки тому +7

    #include
    using namespace std;
    class animal{
    private:
    string Tiger;
    string Cheeta;

    public:
    string Cow;
    string Goat;
    void setdata(string Tig, string Che );
    void getdata(){

    cout

  • @Forever._.curious..
    @Forever._.curious.. 3 роки тому +9

    Such a grt Teacher & Grt Programmer

  • @spoorthi6065
    @spoorthi6065 4 роки тому +9

    Thank you so much sir... Very helpful n amazing ❤️😁

  • @shashankbhosagi
    @shashankbhosagi 3 роки тому

    Thoda aage piche karke dekhna pada
    par atlst samj aagaya
    Thank YOU !!!!!!!!! Bhaiya !!'🤪🤪🙏🙏

  • @vaibhav3214
    @vaibhav3214 2 роки тому +4

    class Animal{
    private:
    string sound;
    int number ; // all animals has different sound
    public:
    string colour,food;
    void setdata(string so,int sp);
    void getdata(){
    cout

  • @TR-lr5dv
    @TR-lr5dv 2 роки тому +10

    Task: 15:00
    #include
    using namespace std;
    class animal{
    private:
    char name[20], color[20];
    public:
    void data();
    void print();
    };
    void animal :: data(){
    coutname;
    coutcolor;
    }
    void animal :: print(){
    cout

  • @Pianissimo311
    @Pianissimo311 3 роки тому +58

    Sir, in a class, you explained private and public modifiers. But what are protected modifiers?

    • @apurbakumarmajumder9478
      @apurbakumarmajumder9478 3 роки тому +29

      protected modifiers have properties of both public and private modifiers. You can inherite properties from a protected modifiers but it will still be private for the user.

    • @maazsajid5742
      @maazsajid5742 Рік тому

      in protected data members of one class can be accessed outside of the class that is in another class

    • @goodvibes7304
      @goodvibes7304 11 місяців тому

      @@maazsajid5742 *subclass or inherited class

  • @adityaagarwal3398
    @adityaagarwal3398 4 роки тому +3

    Bhai thanks and plz make full course of C++ bhai plz and thanks a lot 🙏💕 I love u ❤️😘 from my heart you are my real brother 👦 really bhai

  • @NXN05-m5h
    @NXN05-m5h Рік тому +3

    Harry SIR, i tried a example - 14:47
    #include
    #include
    using namespace std;
    class pen{
    private : float price;
    string ink_colour;
    public :
    void get_data()
    {
    coutprice;
    coutink_colour;
    }
    void prn_data()
    {
    cout

  • @JD_shots_SJ
    @JD_shots_SJ 3 роки тому +4

    Thank you so much Harry bhai for making this video and I will see you next time ❤️☺️

  • @muskangupta6534
    @muskangupta6534 3 роки тому +4

    Class Students {
    Private :
    int mobileNo;
    string address;
    Public:
    Int rollNo;
    String name;
    Void putdata(int mob , string addr);
    Void showdata ()
    {
    Cout

    • @hassanjaveed2168
      @hassanjaveed2168 2 роки тому

      Sister Baki program sahi hai but
      mobile No, address ko cout karwa hi nahi

  • @anasqureshi4181
    @anasqureshi4181 4 роки тому +1

    class Animals{
    public:
    int legs=4;
    };
    class dog:public Animals{
    public:
    int ear=2;
    };
    int main ()
    {
    dog d;
    cout

  • @shaikhfaizan6233
    @shaikhfaizan6233 2 роки тому +12

    harry sir your teaching is fabulous.. your explaination is so good..u r nice sir for coding.

  • @ezioafaqyt8442
    @ezioafaqyt8442 Рік тому

    //create a class
    class Animal
    {
    public:
    int a;
    void out()
    {
    cout

  • @deepspace820
    @deepspace820 Рік тому +1

    # include
    using namespace std;
    class Fruit{
    public:
    string name;
    string colour;

    };
    int main()
    {
    Fruit apple;
    apple.name="Apple";
    apple.colour="yellow";
    cout

  • @nikhilraj1842
    @nikhilraj1842 4 роки тому +78

    #include
    #include
    using namespace std;
    // 14:57
    class Animal
    {
    public:
    string name,sound;
    int speed;
    void set_animal_data(string parm_name,string param_sound,int param_speed);
    void get_animal_data();
    };
    void Animal :: set_animal_data(string param_name,string param_sound,int param_speed){
    name = param_name;
    sound = param_sound;
    speed = param_speed;
    }
    void Animal :: get_animal_data(){
    cout

    • @prernaprerna4028
      @prernaprerna4028 2 роки тому

      get_animal_data function m cout nhi krna?? ?

    • @harshprajapat165
      @harshprajapat165 2 роки тому +1

      Nikhil, here you use
      in cpp . Can we use this because this is for c and in cpp there is alternate called

    • @nikhilraj1842
      @nikhilraj1842 2 роки тому

      @@harshprajapat165 Yup! You can use it

    • @mohdfarman5287
      @mohdfarman5287 2 роки тому

      @@prernaprerna4028 why bro get_animal_data function me he krna h

  • @princemishra3549
    @princemishra3549 3 роки тому +15

    there is the only difference between structure and classes in cpp that is default access specifier:
    In struct it is public and in class it is private.

  • @prathamesh2906
    @prathamesh2906 4 роки тому +2

    class animal{
    int eye;
    string type;
    string name;
    int years;
    };

  • @csssatyamjadhav7681
    @csssatyamjadhav7681 3 роки тому +9

    Thank you for the video harry bhai..
    your videos make this Lockdown productive for us

  • @arcticgaming3904
    @arcticgaming3904 2 роки тому

    Sir aap kitne great ho sab khuch free de rakkha source code bhi ,,,, I like you sir ,,,

  • @sakshi9119
    @sakshi9119 3 роки тому +3

    9:24 class function definition

  • @ishanmathur447
    @ishanmathur447 2 роки тому +2

    #include
    using namespace std;
    class animal{
    private:
    string name,colour;
    int age;
    public:
    string sound;
    int cost;
    void setdata(string a,string b,int c);
    void getdata(){
    cout

  • @___vijay___
    @___vijay___ 4 роки тому +7

    bro we can make functions using struct
    the only difference between struct and class is by default in struct variables are public whereas in class they are private.

    • @adarshmishra8198
      @adarshmishra8198 4 роки тому

      And i think the inheritance feature also

    • @ajayjangid1164
      @ajayjangid1164 4 роки тому

      adarsh mishra not only inheritance there are many class properties which you can see in prev-vedio or search about it. So bcoz of that all properties of class makes a huge diff between structure and class

    • @ajayjangid1164
      @ajayjangid1164 4 роки тому

      No in structure we cannot define Functions, and the solution of this is class🤟🏼

    • @waise_otaku665
      @waise_otaku665 2 роки тому

      If you are using struct in cpp than there us no difference in class or struct...... You can also use the concept of inheritance in struct .... Know your fact before talking

  • @Niketsinghcse
    @Niketsinghcse 2 роки тому

    class animal {
    private:
    int bark;
    public:
    void setdata(int bark1)
    int legs;
    }

  • @rkgaming9289
    @rkgaming9289 2 роки тому +2

    #include
    using namespace std;
    class Employee{
    int salary;
    public:
    int id;
    string name;
    void setdata(int x);
    void getdata(){
    cout

  • @Gaurav_chandnani
    @Gaurav_chandnani 2 роки тому +2

    People says best of luck for exams... And i say jab code with harry hai sath to darnai ki kya baat

  • @nishumittal4277
    @nishumittal4277 2 роки тому +6

    If we don't declare access modifier to any variable and function by default it get private.

  • @pawansahu5587
    @pawansahu5587 Рік тому

    #include
    using namespace std;
    class person
    {
    public:
    string name;
    int age;
    int height;
    int weight;
    void getdata()
    {
    cin>>name>>age>>height>>weight;
    }
    void talk()
    {
    cout

  • @jagannathbiswas
    @jagannathbiswas 3 роки тому +4

    Could we get some questions for this chapter?

  • @Lets-Create-1
    @Lets-Create-1 Рік тому +2

    Thanks Bhaiya

  • @Umarfarooq_muf
    @Umarfarooq_muf 2 роки тому +1

    Thankuuuu very much sir love u from pak 💛

  • @khushaalsharma
    @khushaalsharma 3 роки тому +6

    sir if we write those functions under private as you have written them under public can we use them in main program??

  • @RanaAliHusnain-co9qt
    @RanaAliHusnain-co9qt 6 місяців тому

    #include
    using namespace std;
    class vehicle
    {
    private:
    int id;
    public:
    string model;
    void setter(int i, string m)
    {
    id=i;
    model=m;
    }
    void getter()
    {
    cout

  • @adipratyush8
    @adipratyush8 2 роки тому +9

    Answer of the animal class:
    #include
    using namespace std;
    class animal{

    private: string name,sound,family;

    public: int legs,age;

    void setdata( string name1,string sound1,string family1, int legs1, int age1);
    void getdata(){
    cout

  • @deepspace820
    @deepspace820 Рік тому +2

    # include
    using namespace std;
    class student
    {
    private:
    string religion;
    string gender;
    public:
    string name;
    int roll_no;
    void setdata(string religion , string gender ){
    cout

  • @MNTNMX
    @MNTNMX Рік тому +5

    #include
    using namespace std;
    class Rectangle
    {
    private:
    int length, width, area, peri;
    public:
    void SetDimensions(int l, int b);
    void CalculateArea();
    void CalculatePerimeter();
    };
    void Rectangle ::SetDimensions(int l, int b)
    {
    length = l;
    width = b;
    }
    void Rectangle ::CalculateArea()
    {
    area = length * width;
    cout

  • @HemaangAmesaara
    @HemaangAmesaara 4 роки тому +1

    Class animal {
    Private:
    Int eye, hand;
    Public:
    Int leg;
    Void setData(Int a, Int b);
    Void getData(){
    Cout

    • @AnjaliChauhan-gh7me
      @AnjaliChauhan-gh7me 4 роки тому

      Wah 👏👏👏👏👏

    • @mrgfx9954
      @mrgfx9954 2 роки тому

      Bro ther private na likho toh bhi automatically private hi rehta 🌝

  • @bestedmmusic512
    @bestedmmusic512 4 роки тому +10

    Nice bro
    Easy to Explain
    Upload next video 😍

  • @harshthakur7451
    @harshthakur7451 4 роки тому +7

    Dear sir,
    Void employee :: setdata(int a,int b,int c)
    {
    a=a1;// a= a1 karne se kya hua?
    b=b1;
    C=c1;
    }

    • @aashishkumar4957
      @aashishkumar4957 4 роки тому

      Isse aage jo main me set deta me jo value dali 1,2,4 usko a,b,c me dalne k liy ye function bnaya h 🤗

    • @Himanshusingh-iw4mn
      @Himanshusingh-iw4mn 3 роки тому +4

      Syntax galat likha h aap ne
      setdata(int a1,int b1, int c1) hoga .
      Badd mai jab main () mai jab user input daalega wo a1 , b1, c1 mai store hoga fhir uske value a, b, c mai chale jayege.
      Fhir cout

  • @hammadtufailjhujh6542
    @hammadtufailjhujh6542 2 роки тому

    Love from PAK whole university know you sir almost

  • @LokeshSharma-bf2cj
    @LokeshSharma-bf2cj 3 роки тому +7

    Sir, is this similar to structure in c??

  • @programmerpro635
    @programmerpro635 4 роки тому

    class Player {
    public:
    string name;
    string favGame;
    int age;
    void changeFavGame(string gameName){
    cout

  • @ujwalkumar2374
    @ujwalkumar2374 3 роки тому +15

    Just a small correction, access modifiers exist in structures also

    • @user-zo9ye6de5e
      @user-zo9ye6de5e 3 роки тому +4

      and also structures in c++ allows function definition inside the structure

  • @keshavsarda8413
    @keshavsarda8413 2 роки тому +1

    void class name::function name(arguments);

  • @adarshsinghfit837
    @adarshsinghfit837 2 роки тому +4

    #include
    #include
    using namespace std;
    class Animal
    {
    private:
    string name;
    public:
    string colour, bread;
    void setData(string name, string colour, string bread);
    void showData()
    {
    cout

  • @AnniSoH3142
    @AnniSoH3142 5 місяців тому

    12:36 so that's like function prototyping right? We pre-declare a function call and then define the said function later.

  • @sarthakvats1634
    @sarthakvats1634 3 роки тому +22

    Sir, Are the content(variables + functions) written in the public category up to the end of the class '}' is considered as public or it gets terminated after the semicolon; at the end of the next line where public was written?

    • @harshprajapat165
      @harshprajapat165 2 роки тому

      All the variable or function can be written either in private or in public depending on your choice or situation.

    • @contentofAI
      @contentofAI 2 роки тому

      doesn't get terminated after; but terminated or we can say considered up to }

  • @PHANTOMWORLD
    @PHANTOMWORLD 4 роки тому +2

    class student{
    float percentage;
    int roll no.;
    public:
    char* name[20], section;
    };

  • @sumanpal4787
    @sumanpal4787 4 роки тому +4

    Vaiya next videos Kab ayega?
    Thodi jaldi kro 🙏🙏🙏🙏

  • @movies_house5
    @movies_house5 9 місяців тому

    class addtion
    {
    private:
    int a ,b;
    public:
    void setdata(int a ,int b);
    void getdata();
    };

  • @yashvantjadhav5713
    @yashvantjadhav5713 3 роки тому +3

    Harry bhai can we use "void setData and getData" for public function
    plz reply I am waiting for your reply

    • @sougata_paul
      @sougata_paul 3 роки тому +4

      Functions are created for private use only... Set data... Is used bcoz we want to access the private variables through function... And get data is jst to print it.. To access the public variable we don't need functions we can directly access it.. By using dot..

  • @craftsworld3237
    @craftsworld3237 2 роки тому +2

    12:30 set data ko aage define krne ka tarika to bata dia but get data ko agar aage define krna ho to kaise krenge??

  • @tgenrex7896
    @tgenrex7896 2 роки тому +3

    #include
    using namespace std;
    class animal
    {public :
    string name;
    float size;
    int speed;
    void setData(string x_name, float x_size, int x_speed);
    void getData(){
    cout

  • @tgtitan7729
    @tgtitan7729 Рік тому

    time space - 14:59
    #include
    #include
    using namespace std;
    class TATA
    {
    private:
    int car_number;
    string name;
    public:
    string c_name; // c declar for a car
    string type;
    float price;
    float speed;
    float weight;
    void cardetails(int number,string a);
    void getdata(){
    cout

  • @zeeshanhaider9092
    @zeeshanhaider9092 4 роки тому +4

    Sir please design a cource for visual programming with c# i direly need it. You are the only one person to whom i can understand.
    Please sir upload this cource i shall be very thankful to you.

  • @rondotTs
    @rondotTs 4 роки тому +2

    #include
    using namespace std;
    class Employee
    {
    private:
    int salary, pts;
    public:
    int experience;
    string name ;
    void setData(int _salary,int _pts);
    void getData();
    };
    void Employee :: setData(int _salary, int _pts){
    salary=_salary;
    pts = _pts;
    }
    void Employee :: getData(){
    cout

  • @mayankagarwal8026
    @mayankagarwal8026 2 роки тому +5

    #include
    using namespace std;
    class animal
    {
    private :
    string animal_name,type;
    public :
    int speed;
    void setdata(string animal_name1, string type1);
    void getdata(){
    cout

  • @fluxygamingyt3227
    @fluxygamingyt3227 2 роки тому

    13:10 aapne pehle btaya tha ki template same ho to koi frk nhi pdta..is case me age do employee class bna diya jaye emplyee : : setdata bhi do ho to kaise find krega function ya fir setdata aur setdata1 krke bnana pdega ....? please reply.

  • @shivam_poddar
    @shivam_poddar 4 роки тому +7

    #include
    using namespace std;
    class animal
    {
    private:
    char name;
    int id;
    float price;
    public:
    void setData(char n, int i, float p);
    void showData(){
    cout

  • @shravankumarpandey108
    @shravankumarpandey108 8 місяців тому +2

    #include
    using namespace std;
    class animalSound{
    private:
    string s1,s2,s3;
    public:
    string s4,s5;
    void setSound(string a, string b, string c);
    void getSound(){
    cout