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



►Source Code & Resources: https://codewithharry.com/videos/cpp-tutorials-in-hindi-21
►This video is a part of my C++ playlist: https://www.youtube.com/playlist?list=PLu0W_9lII9agpFUAlPFe_VNSlXW5uE0YL
►For Doubt Solving, Brain Storming Sessions & guaranteed replies, join the channel membership here: https://www.youtube.com/channel/UCeVMnSShP_Iviwkknt83cww/join
►Click here to subscribe – https://www.youtube.com/channel/UCeVMnSShP_Iviwkknt83cww
►Checkout my English channel here: https://www.youtube.com/ProgrammingWithHarry

Best Hindi Videos For Learning Programming:

►Learn Python In One Video – https://www.youtube.com/watch?v=ihk_Xglr164

►Python Complete Course In Hindi – https://www.youtube.com/playlist?list=PLu0W_9lII9agICnT8t4iYVSZ3eykIAOME

READ ALSO:  Classical Mechanics | Important questions to score 90+ | Raj Physics Tutorials #physics #science | Video

►C Language Complete Course In Hindi –
https://www.youtube.com/playlist?list=PLu0W_9lII9aiXlHcLx-mDH1Qul38wD3aR&disable_polymer=true

►JavaScript Complete Course In Hindi –
https://www.youtube.com/playlist?list=PLu0W_9lII9ajyk081To1Cbt2eI5913SsL

►Learn JavaScript in One Video – https://www.youtube.com/watch?v=onbBV0uFVpo

►Learn PHP In One Video – https://www.youtube.com/watch?v=xW7ro3lwaCI

►Django Complete Course In Hindi –
https://www.youtube.com/playlist?list=PLu0W_9lII9ah7DDtYtflgwMwpT3xmjXY9

►Machine Learning Using Python – https://www.youtube.com/playlist?list=PLu0W_9lII9ai6fAMHp-acBmJONT7Y4BSG

►Creating & Hosting A Website (Tech Blog) Using Python – https://www.youtube.com/playlist?list=PLu0W_9lII9agAiWp6Y41ueUKx1VcTRxmf

READ ALSO:  Data Science Tutorials | Part 3 Session 3 | Linear Regression in Excel | Video

►Advanced Python Tutorials – https://www.youtube.com/playlist?list=PLu0W_9lII9aiJWQ7VhY712fuimEpQZYp4

►Object Oriented Programming In Python – https://www.youtube.com/playlist?list=PLu0W_9lII9ahfRrhFcoB-4lpp9YaBmdCP

►Python Data Science and Big Data Tutorials – https://www.youtube.com/playlist?list=PLu0W_9lII9agK8pojo23OHiNz3Jm6VQCH

Follow Me On Social Media
►Website (created using Flask) – http://www.codewithharry.com
►Facebook – https://www.facebook.com/CodeWithHarry
►Instagram – https://www.instagram.com/codewithharry/
►Personal Facebook A/c – https://www.facebook.com/geekyharis
Twitter – https://twitter.com/Haris_Is_Here
Proudly WWW.PONIREVO.COM

Source

33 Comments

  1. #include <iostream>

    #include <string.h>

    #include<string>

    using namespace std;

    class animal

    {

    public:

    string name, colour;

    string legs, speed;

    void num_getdata(void);

    void getdata(void);

    void showdata()

    {

    cout << "Type of animal is " << name << endl;

    cout << name << " has " << legs << " legs" << endl;

    cout << "Its colour is " << colour << endl;

    cout << name << " Runs with the spped of " << speed <<" KMPH" << endl;

    }

    };

    void animal::num_getdata(void)

    {

    legs="4";

    speed="40";

    }

    void animal::getdata(void)

    {

    name= "DOG";

    colour= "BLACK";

    }

    int main()

    {

    animal dog;

    dog.num_getdata();

    dog.getdata();

    dog.showdata();

    }

  2. #include<bits/stdc++.h>

    #include<vector>

    #include<list>

    using namespace std;

    class hetfadia

    {

    private:

    int het,fadia,aneeket;

    public:

    void set(int a, int b, int c){

    het=a;

    fadia=b;

    aneeket=c;

    }

    void get(){

    cout<<"You have entered the integer: "<<het<<endl;

    cout<<"You have entered the integer: "<<fadia<<endl;

    cout<<"You have entered the integer: "<<aneeket<<endl;

    }

    };

    int main(){

    hetfadia this; // here this is a class

    this.set(1,2,32);

    this.get();

    return 0;

    }

  3. #include<bits/stdc++.h>

    #include<vector>

    #include<list>

    using namespace std;

    class hetfadia

    {

    private:

    int x,y,z;

    // as these are private you will not be able to access through main()

    public:

    int d,e;

    void dataSetter(int x1, int y1, int z1){

    x=x1;

    y=y1;

    z=z1;

    }

    void dataextractor(){

    cout<<"The value of x is "<<x<<endl;

    cout<<"The value of y is "<<y<<endl;

    cout<<"The value of z is "<<z<<endl;

    }

    };

    int main(){

    hetfadia het;

    het.dataSetter(1,2,3);

    het.dataextractor();

    return 0;

    }

  4. #include <<iostream>>
    using namespace std;
    class student
    { private;
    Int a, int b
    public;
    int d, int e, int f
    void marks(d1, int e1, int f1);
    void pocket_money_of_month();
    { cout<<"the pocket money"a in the
    b cout<<"month"
    int main;
    {void student :: void marks(int d, e1, f1);
    {d =d1;
    e=e1;
    f=f1;
    }
    }
    return 0;

  5. Class animal {
    Private:
    Int eye, hand;
    Public:
    Int leg;
    Void setData(Int a, Int b);
    Void getData(){
    Cout<<"The value of eye is "<<eye<<endl;
    Cout<<"The value of hand is "<<hand<<endl;
    Cout<<"The value of leg is "<<leg<<endl;
    }
    };

    Void animal :: setData(Int a, Int b){
    eye = a;
    hand = b;
    }

    Int main(){
    animal dog;
    dog.leg = 4;
    dog.setData(2, 0);
    dog.getData();

    Return 0;
    }

  6. #include<iostream>
    using namespace std;

    typedef struct student
    {
    int sRoll;
    char sName;
    float sMarks;
    }s1;

    int main(){
    s1 harry;
    harry.sName='c';
    harry.sMarks=43.6;
    harry.sRoll=56;
    cout<<"value of harry are"<<endl<<harry.sMarks<<endl<<harry.sName<<endl<<harry.sRoll<<endl;
    return 0;

    }
    upr wala code run kr rha hai but type def remove krne ke bad error aa rha hai :).

    ……………………….

    aapne bola ki c++ already typedef krke deta hai. lekin yha typedef hta dene ke bad error aa rha hai variable.

    ………..

    harry@hariom-annabele:~/Desktop/vs code c++$ cd "/home/harry/Desktop/vs code c++/" && g++ typedef.cpp -o typedef && "/home/harry/Desktop/vs code c++/"typedeftypedef.cpp: In function ‘int main()’:
    typedef.cpp:12:12: error: expected ‘;’ before ‘harry’
    s1 harry;
    ^~~~~
    typedef.cpp:13:9: error: ‘harry’ was not declared in this scope
    harry.sName='c';
    ^~~~~
    …………

    ye error de rha hai..

  7. harry bhai aur videos upload kro c++ ke . and plz competitive coding kaise karna hai wo bhi batana pzzzzz!!!!

  8. 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.

Comments are closed.