Mastering Classes & Objects Made Simple: Your Easy Guide to C++ !
Classes and Objects Demonstration code [C++] :
#include<iostream>using namespace std;class Smartphone{public:string brand;int ram;int storage;void details(string name, int ram, int storage){this->brand = name;this->ram = ram;this->storage = storage;}};int main(){Smartphone phone1,phone2,phone3;phone1.details("Xiomi",4,64);phone2.details("Iphone",8,128);phone3.details("Samsung",4,64);cout<<"Phone 1 Details :"<<endl;cout<<"Name : "<<phone1.brand<<endl;cout<<"Ram : "<<phone1.ram<<endl;cout<<"Storage : "<<phone1.storage<<endl;cout<<"Phone 2 Details :"<<endl;cout<<"Name : "<<phone2.brand<<endl;cout<<"Ram : "<<phone2.ram<<endl;cout<<"Storage : "<<phone2.storage<<endl;cout<<"Phone 3 Details :"<<endl;cout<<"Name : "<<phone3.brand<<endl;cout<<"Ram : "<<phone3.ram<<endl;cout<<"Storage : "<<phone3.storage<<endl;return 0;}
Hey, thanks for watching our video about C++ Classes and objects ! In this video we’ll walk you through:
- Classes
- Syntax
- Objects
- Syntax
- Methods
- Syntax
- The "this" keyword
- Access Modifier
- Code
All codes are available at my GitHub account, check them out here:
https://github.com/shyamkanth/Placements
Check out other videos from C++ Confusion Buster playlist: https://youtube.com/playlist?list=PLNXqJgOsTCZMUl5BIzUHGJVTH4YMZDkLb&si=hDXYryaWux1Se7PJ
Check out our channel here: https://www.youtube.com/@DevelopersByte
Find us at: https://shyamkanth.github.io/
Timestamps:
0:00 Intro
1:20 Concept of class
14:12 Syntax of class
15:45 Concept of Objects
17:10 Syntax of objects
26:35 Code
32:32 Concept of Methods
36:55 The "this" keyword
52:06 Code
57:03 Access Modifier
01:00:40 Outro
About our channel:
Our channel is about Revealing the secrets of Data Structure. We cover lots of cool stuff such as Codes, Concepts and Implementations.
Check out our channel here: https://www.youtube.com/@DevelopersByte
Don’t forget to subscribe!
Follow me on social media:
Get updates or reach out to Get updates on our Social Media Profiles!
GitHub: https://github.com/shyamkanth/
Instagram: https://instagram.com/still_23.6_8
Instagram personal: https://instagram.com/itz_sammmii
No comments:
Post a Comment