#include class Car{ public: std::string make; std::string model; int year; std::string color; Car(std::string make, std::string model, int year, std::string color){ this->make = make; this->model = model; this->year = year; this->color = color; } }; int main() { //constructor = special method that is automatically called when an object is instantiated // useful for assigning values to attributes as arguments Car car1("Chevy", "Corvette", 2022, "blue"); Car car2("Ford", "Mustang", 2023, "red"); std::cout
#include
class Car{
public:
std::string make;
std::string model;
int year;
std::string color;
Car(std::string make, std::string model, int year, std::string color){
this->make = make;
this->model = model;
this->year = year;
this->color = color;
}
};
int main() {
//constructor = special method that is automatically called when an object is instantiated
// useful for assigning values to attributes as arguments
Car car1("Chevy", "Corvette", 2022, "blue");
Car car2("Ford", "Mustang", 2023, "red");
std::cout
am i tripping? why is this comment 1 year old but the video was posted 2 weeks ago
@@lv3234the video was unlisted/private before, after you make it public it will then set a new video date, except for comments.
I am seeing this too! 😮
The video is 6 months old but this comment and some comments ar 2 years old. 😳@@lv3234
Great video!
can you make a vid about the destructors as well 😔, ty
Great lesson❤❤❤
Broooo...🎉🎉🎉
Great!
Great lesson.
Love the break down. Clear and helpful
That was perfect❤
Thanks
thx bro
Thank you sir😃
Please one on vectors and how to use them
can we use different statements in constructers like in c# and java or just can initialize the variables
thank you
❤❤❤❤
How do you add methods to a constructer
one night before semester exam 💀💀
class game{
public:
std::string gamename;
int releasedate;
game(std::string playername,int releasedate){
this->playername=playername;
this->releasedate=releasedate;
}
};
Create tutorial for golang
Wow another thing C++ does better than C#
Why do I say that?
C++ () standard brackets
C# {} used in a new constructor
include namespace std;
class Jatt {
public:
string Name;
string birthplace;
string height;
Jatt(string Name, string birthplace, string height){
this->Name=Name;
this->birthplace=birthplace;
this->height=height;}
};
Bro patrick is not 40😢
#include
class Dish{
public:
int calories;
std::string ingridients;
int protein;
std::string taste;
Dish(int calories, std::string ingridients, int protein, std::string taste){
this->calories = calories;
this->ingridients = ingridients;
this->protein = protein;
this->taste = taste;
}
};
int main(){
Dish macandcheese(800, "Mac and Cheese", 50, "Yummy");
std::cout
#include
class Car{
public:
std::string brand = "Vehicle";
std::string model = "Model";
int year;
void drive(){
std::cout
WifeCar.Drift()