Create Class in C++ | Class in OOP



in this video we will discuss how to create class in c++ | Class in OOP-
//Create an class called "myclass" and access the attributes
#include<iostream>
using namespace std;
class MyClass {       // The class
  public:             // Access specifier
    int myNum;        // Attribute (int variable)
    string myString;  // Attribute (string variable)
};

int main() {
  MyClass myObj;  // Create an object of MyClass

                  // Access attributes and set values
  myObj.myNum = 500; 
  myObj.myString = "MsCube Tech";

  // Print attribute values
  cout <<"Number :"<< myObj.myNum <<endl;
  cout <<"Channel :" <<myObj.myString;
  return 0;
}

► Shopify For Beginners :- https://youtube.com/playlist?list=PLm... ► Google AdSense :- https://www.google.com/adsense/start/ ► Google Cloud Boost Playlist - https://www.youtube.com/playlist?list... ► Google Cloud SQL Playlist:- https://youtube.com/playlist?list=PLm... ► GitHub Playlist - https://youtube.com/playlist?list=PLm... ► Flutter For Beginners :- https://youtube.com/playlist?list=PLm... ► WordPress Free themes For Beginners :- https://youtube.com/playlist?list=PLm... ► HTML & CSS and JAVASCRIPT Projects:- https://youtube.com/playlist?list=PLm... ► C++ For Beginners Playlist :- https://youtube.com/playlist?list=PLm... ► C++ Basic Programs : https://youtube.com/playlist?list=PLm... ► SQL Tutorials For Beginners: https://youtube.com/playlist?list=PLm... 🔁 Facebook: https://www.facebook.com/mscubetechco... 🛑 YouTube : https://www.youtube.com/channel/UC1Gb... #html #css #c++ #cpp #mscubetech #coding #programming #javascript #mscubetech

Post a Comment

0 Comments

Close Menu