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

Поделиться
HTML-код
  • Опубликовано: 5 фев 2020
  • ►Source Code & Resources: codewithharry.com/videos/cpp-...
    ►This video is a part of my C++ playlist: • C++ Tutorials In Hindi
    ►For Doubt Solving, Brain Storming Sessions & guaranteed replies, join the channel membership here: / @codewithharry
    ►Click here to subscribe - / @codewithharry
    ►Checkout my English channel here: / programmingwithharry
    Best Hindi Videos For Learning Programming:
    ►Learn Python In One Video - • Python Tutorial In Hin...
    ►Python Complete Course In Hindi - • Python Tutorials For A...
    ►C Language Complete Course In Hindi -
    • C Language Tutorials I...
    ►JavaScript Complete Course In Hindi -
    • JavaScript Tutorials I...
    ►Learn JavaScript in One Video - • JavaScript Tutorial
    ►Learn PHP In One Video - • Learn Php In One Video...
    ►Django Complete Course In Hindi -
    • Python Django Tutorial...
    ►Machine Learning Using Python - • Machine Learning Tutor...
    ►Creating & Hosting A Website (Tech Blog) Using Python - • [Hindi] Web Developmen...
    ►Advanced Python Tutorials - • Intermediate/Advanced ...
    ►Object Oriented Programming In Python - • Object Oriented Progra...
    ►Python Data Science and Big Data Tutorials - • Python Data Science an...
    Follow Me On Social Media
    ►Website (created using Flask) - www.codewithharry.com
    ►Facebook - / codewithharry
    ►Instagram - / codewithharry
    ►Personal Facebook A/c - / geekyharis
    Twitter - / haris_is_here

Комментарии • 966

  • @blackopss017
    @blackopss017 Год назад +254

    #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 Год назад +9

      same as harry 🤣 good

    • @vedantkokate82
      @vedantkokate82 Год назад +4

      Well try

    • @ArPiTNooB
      @ArPiTNooB Год назад +2

      😁👍

    • @julfekar7564
      @julfekar7564 4 месяца назад +2

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

    • @Bloodflood
      @Bloodflood 12 дней назад

      #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 года назад +246

    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 Год назад +19

      Thanks Gulshan you given me best example of classes and object

    • @imgullu
      @imgullu Год назад +11

      @@rajrai4294 Your Welcome 🤝🏻

    • @curiousritik4558
      @curiousritik4558 Год назад +6

      Syntax error aayega brother 🙂

    • @rajrai4294
      @rajrai4294 Год назад +21

      @@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

      @@rajrai4294 accha

  • @kumarrajneesh2321
    @kumarrajneesh2321 4 года назад +13

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

  • @mystudiobeats8440
    @mystudiobeats8440 4 года назад +14

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

  • @cod-phy1646
    @cod-phy1646 2 года назад +22

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

  • @spoorthi6065
    @spoorthi6065 3 года назад +7

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

  • @theevi1350
    @theevi1350 3 года назад +4

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

  • @devanshusahoo
    @devanshusahoo 2 года назад +9

    #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

  • @CodingGem
    @CodingGem 11 месяцев назад +71

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

    • @runwithrahul
      @runwithrahul 11 месяцев назад

      Yes its great

    • @zubairasghar609
      @zubairasghar609 8 месяцев назад +1

      yar muja tu samaj nahi a rahi

    • @mommy8180
      @mommy8180 7 месяцев назад

      There are only 37 videos of this subject

  • @jersingh6837
    @jersingh6837 11 месяцев назад +3

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

  • @vikrantgodbole1181
    @vikrantgodbole1181 Год назад +73

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

  • @manmeetsinghkhalsa2077
    @manmeetsinghkhalsa2077 Год назад +6

    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

  • @nikhilsrivastava311
    @nikhilsrivastava311 4 года назад +391

    #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

  • @LokeshSharma-hm5jz
    @LokeshSharma-hm5jz Год назад +25

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

  • @rajmanipandey3999
    @rajmanipandey3999 11 месяцев назад +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

  • @AbdullahKhan-hu8fo
    @AbdullahKhan-hu8fo Год назад +2

    Great explanation.your effort is awesome

  • @saurabhpandey2018
    @saurabhpandey2018 3 года назад +15

    This tut boosted my confidence ❤❤

  • @defencofinishers3276
    @defencofinishers3276 3 года назад +6

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

  • @aiexplorations-cv1js
    @aiexplorations-cv1js Год назад +11

    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 11 месяцев назад +2

      Nice code bro 👍

    • @shreyamittal9152
      @shreyamittal9152 11 месяцев назад +1

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

    • @aiexplorations-cv1js
      @aiexplorations-cv1js 11 месяцев назад +1

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

  • @Noobra01
    @Noobra01 Год назад +2

    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

  • @sandeep_cse_3231
    @sandeep_cse_3231 3 года назад +12

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

  • @allfacts1331
    @allfacts1331 2 года назад +4

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

  • @NowThatsCool
    @NowThatsCool 3 года назад +1

    Thank you ,much appreciated

  • @devhunk
    @devhunk 4 года назад +2

    Thankuu sir.... 🥰

  • @dipesh-singla
    @dipesh-singla 4 года назад +13

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

  • @a_12_nileshchaudhari14
    @a_12_nileshchaudhari14 3 года назад +4

    Don't know only few view of this outstanding lecture

  • @Anurag-fk3op
    @Anurag-fk3op 6 месяцев назад

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

  • @AmarKumar-iz8gy
    @AmarKumar-iz8gy Год назад +1

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

  • @csssatyamjadhav7681
    @csssatyamjadhav7681 3 года назад +9

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

  • @sumanjain957
    @sumanjain957 Год назад +4

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

  • @Forever._.curious..
    @Forever._.curious.. 3 года назад +1

    Great thanx
    It went so easy ;

  • @RahulRahul-qj5bv
    @RahulRahul-qj5bv Год назад +1

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

  • @kaminijain5544
    @kaminijain5544 2 года назад +8

    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

  • @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

  • @abhaysangwan483
    @abhaysangwan483 Год назад +1

    Thanks a lot sir,it is a great content❤

  • @umarafzal8009
    @umarafzal8009 4 месяца назад +1

    you are the best teacher in the world

  • @surendrakashyap4859
    @surendrakashyap4859 4 года назад +18

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

  • @shaikhfaizan6233
    @shaikhfaizan6233 2 года назад +12

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

  • @GeekyShubhamSharma
    @GeekyShubhamSharma 4 года назад

    Lovely teaching awesome Harry bhai

  • @mdmuquimakhter5145
    @mdmuquimakhter5145 Год назад

    Dil se Thank you Harry bhai

  • @__ajaymath6585
    @__ajaymath6585 Год назад +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
    😊

  • @nafisahmed3607
    @nafisahmed3607 2 года назад +5

    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

  • @sorcerer_13.19
    @sorcerer_13.19 2 года назад

    Luv you bro.. maza aa jaata hai aap se padh kar..

  • @jkhan7713
    @jkhan7713 3 года назад

    Thank you sir bht bht shukriya♥️♥️♥️♥️

  • @taleofkaran
    @taleofkaran 4 года назад +96

    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 3 года назад +5

      Yaar meri bhi

    • @dattpostariya8402
      @dattpostariya8402 3 года назад +5

      Midsam is very very soon

    • @tasneemahmad7858
      @tasneemahmad7858 3 года назад +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

  • @18aadi70
    @18aadi70 2 года назад +7

    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

  • @avinashkumawat4904
    @avinashkumawat4904 3 года назад +1

    Pura khol ke rakh diya😍

  • @corashidshaikh2890
    @corashidshaikh2890 2 года назад +1

    Thx great video..❤️

  • @30vaibhavdhaygondexdr.v.sa22
    @30vaibhavdhaygondexdr.v.sa22 3 года назад +9

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

  • @Forever._.curious..
    @Forever._.curious.. 3 года назад +9

    Such a grt Teacher & Grt Programmer

  • @atharvpatharkar1652
    @atharvpatharkar1652 3 года назад +1

    Thank You 🙏🏻

  • @mohinishendye1040
    @mohinishendye1040 2 года назад

    Greatt!!❤️

  • @skillslogo
    @skillslogo Год назад +6

    #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

  • @vaibhav3214
    @vaibhav3214 2 года назад +3

    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

  • @karanchouhan2247
    @karanchouhan2247 2 года назад +1

    Thank bhiya for this valuable tutorial

  • @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 Год назад

      @@vritikapathare noice

  • @bestedmmusic512
    @bestedmmusic512 4 года назад +10

    Nice bro
    Easy to Explain
    Upload next video 😍

  • @0008Arif
    @0008Arif 4 года назад +1

    Sir thanks for these videos

  • @dhairyamehta8642
    @dhairyamehta8642 3 года назад +1

    superb videos!

  • @AzeemKhan-sr4my
    @AzeemKhan-sr4my 4 года назад +15

    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.

  • @sakshi9119
    @sakshi9119 3 года назад +3

    9:24 class function definition

  • @shashankbhosagi
    @shashankbhosagi 2 года назад

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

  • @hrittickdebnath35
    @hrittickdebnath35 4 года назад

    Great course

  • @sufiyanmogal1527
    @sufiyanmogal1527 Год назад +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 Год назад +1

      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 Год назад +1

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

    • @myth_snipe7737
      @myth_snipe7737 11 месяцев назад

      string requires header file right?

    • @sufiyanmogal1527
      @sufiyanmogal1527 11 месяцев назад

      ​​​@@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 11 месяцев назад

      ​@@unknownking798most welcome bro ❤

  • @nishumittal4277
    @nishumittal4277 2 года назад +6

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

  • @samirkumarmajhi4749
    @samirkumarmajhi4749 Год назад

    great course harry

  • @royfamily9273
    @royfamily9273 2 года назад

    Thanks Harry Bhaiya

  • @piyushdixit6353
    @piyushdixit6353 4 года назад +98

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

  • @Pianissimo311
    @Pianissimo311 3 года назад +57

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

    • @apurbakumarmajumder9478
      @apurbakumarmajumder9478 2 года назад +28

      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 6 месяцев назад

      @@maazsajid5742 *subclass or inherited class

  • @AWAS_S
    @AWAS_S Год назад +2

    Thanks Bhaiya

  • @ravalsinhal8078
    @ravalsinhal8078 10 месяцев назад

    Thank you very much sirji 🙏🏻🙏🏻

  • @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.

    • @qqqppp11
      @qqqppp11 2 года назад

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

  • @muhammadareebkazmi9476
    @muhammadareebkazmi9476 2 года назад

    Thank you, Harry bhai!

  • @utsavseth6573
    @utsavseth6573 Год назад

    very good explaination.

  • @jagannathbiswas
    @jagannathbiswas 2 года назад +4

    Could we get some questions for this chapter?

  • @khushaalsharma
    @khushaalsharma 2 года назад +6

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

  • @kalpendrayadav2450
    @kalpendrayadav2450 Год назад

    Thank you so much sir 😊😃💝

  • @anuragthakur0724
    @anuragthakur0724 Год назад

    Thank you! 😇

  • @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.

  • @muskangupta6534
    @muskangupta6534 3 года назад +3

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

    • @hassanjaveed2168
      @hassanjaveed2168 Год назад

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

  • @educateyourself773
    @educateyourself773 3 года назад

    Great efforts

  • @apurvasonawane5049
    @apurvasonawane5049 2 года назад

    Thank you Harry bhaii!🥳

  • @pulastyabhagwat7774
    @pulastyabhagwat7774 10 месяцев назад +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

  • @suhashisumanshukla2779
    @suhashisumanshukla2779 3 года назад +8

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

    • @Gangbuster74
      @Gangbuster74 3 года назад

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

    • @shikhargupta8759
      @shikhargupta8759 3 года назад

      Where is private keyword???

  • @dhairyamehta8642
    @dhairyamehta8642 3 года назад +1

    Nice video!

  • @___vijay___
    @___vijay___ 3 года назад +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 3 года назад

      And i think the inheritance feature also

    • @ajayjangid1164
      @ajayjangid1164 3 года назад

      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 3 года назад

      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

  • @adarshsinghfit837
    @adarshsinghfit837 2 года назад +3

    #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

  • @gopalchavan8806
    @gopalchavan8806 Год назад

    Thank you bhai... ❤

  • @codingislit1404
    @codingislit1404 3 года назад

    Thanks bhaiya.

  • @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

  • @sandeeppareek8941
    @sandeeppareek8941 4 года назад +10

    #include
    #include
    #include
    using namespace std;
    class animal
    {

    public:
    string name, colour;
    string legs, speed;
    void num_getdata(void);
    void getdata(void);
    void showdata()
    {
    cout

  • @csea_37_shayoribhowmick53
    @csea_37_shayoribhowmick53 2 года назад

    Thank you so much Sir

  • @venerate777
    @venerate777 Год назад +2

    Sir jab ham koi program run karte hai, tab compiler sabse pehele program ke konse part me jata hai ??

  • @ujwalkumar2374
    @ujwalkumar2374 2 года назад +15

    Just a small correction, access modifiers exist in structures also

    • @user-zo9ye6de5e
      @user-zo9ye6de5e 2 года назад +4

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

  • @nikhilraj1842
    @nikhilraj1842 4 года назад +77

    #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

  • @alirizwi8587
    @alirizwi8587 Год назад

    Thanks man ❤️

  • @keshavsarda8413
    @keshavsarda8413 Год назад +1

    void class name::function name(arguments);

  • @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..

  • @sumanpal4787
    @sumanpal4787 4 года назад +4

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

  • @miraclespiritualastro
    @miraclespiritualastro 3 года назад

    very nice sir jee maza aagaya