If you've made it this far and you've given your best efforts in your endeavors to understand C++, give yourself a round of applause. Close to a million people have watched the first video and many of them have stopped watching, and I'm going ahead to guess and say that they've given up. Not us though. We are determined and focused and we will master this programming language. Congrats to everyone so far as this is something we should all be proud of! Onward to tutorial 73!
Brian Davis many of them have stopped watching because his lessons are pretty low...you won't get a job in C++programming with these kind of lessons that he presents here
It's been 5 years but to enable word warp: Settings -> Editor -> General Settings -> Other editor settings(second tab) -> check box "Word warp". Awesome tuts by the way.
In case you have not found out it yet - to wrap words: go to main menu Settings ( right before Help), Editor, Other Options, Word wrap. To Copy/ Paste with right click - right click, hover Edit - there are all regular Edit options. A long option though.
That's why you should watch only a few episodes a day and consolidate the lessons on your PC, in your Visual Studio/CodeBlocks, by yourself. And as we Russians say: repetition is mother of teaching.
How he used that private class member to print the output In one of his previos videos he said that we can't access the private class directly.but its working..help plz
At tutorial 45. Well I think everyone include myself has done pretty well getting this far. Can't wait for inheritance looked around at afew C++ game developing videos and you seem to need inheritance for alot of stuff.
What makes this better than saying, for instance: Sally::Sally(int a, int b) { Sally::regVar = a; Sally::constVar = b; // Will throw an error I figured. } I will use member initializers since it allows you to initialize const variables but besides that whats the point? I can see maybe calling Sally::regVar is an issue as a reference to the entire class and not the object being initialized, an example of what I mean in Java is public Sally(int a, int b){ Sally.a = a; Sally.b = b; } though in Java this is easily remedied with the "this" keyword which doesnt have the same function in C++. So is it simply as a safety measure and as a way to initialize any member variable at construction?
Can someone please tell me why i get "No such file in the directory" when I try to run the program? I saved all files in the same place. when I was creating the class, I unchecked destructor and the visual thing and also unchecked relative path.
The two variable is inn the private part of the class but you don't need a function to set it and get it? Why? Is it because it called from the constructor?
What about references or built-in arrays? What about initializing objects that don't have a default constructor? What about an object that is expensive to default-construct, but that you just discard anyway when you assign to it in the body?
At 5:52 , Bucky says that Sally so( )is a constructor but as i remember a constructor always has the same name as that of the class.Can anyone explain?
Hi Bucky, first of all THANKS SO MUCH for your tutorials, i've just got a couple of questions regarding this tutorial, in the previous one you wrote 'const' at the end of the () in the sally.h file, but now you put it in the front of your variable, does that make any difference? And also, you only made one object, but it was able to reach both the regular and const variables, whereas in the previous tutorial you said u'd need a 'const' object to access const variables? please clarify? Thanks!:)
When I create multiple object and pass different values to each objects in main function the value of constant variable is also modified which by definition should not. The two parameters which the object takes is an integer and a constant variable. Can someone explain? Thank you.
You don't need 'Word-Wrap' because you can just hit enter in the middle of a line, and continue the remaining code on the next line. C++ allows this. ex. ' cout
Bucky, you inquired as to why the member initializer list goes between the right parentheses & the left curly brace? It's because that they - the other software language developers - hit me with the question so fast and furious and thus demanded an answer right away! So THE LORD had me respond with that particular position simply because there was no other convenient place to put it! Anywhere else, and that space was already taken - defined - and there simply wasn't any more key characters on the keyboard that would properly fit the situation at hand. So, the only logical conclusion that we came up with (in such short notice) was to place the member initializer list between the parenthetical statement and the curly brace statements declarator. Now, do you understand? Does it make sense? Can you come up with a better system? Think about it! Grace of God, Peace of Jesus Christ, and Love from, ~ The Holy Ghost
Cant we do it like this ? Sally :: Sally(int a , int b){ regVar = a ; constVar = b; } Even here we are just intializing the variables, since Sally() is executed the moment an obj is created i dont think it will make a difference.
@hbaderman Well .. Unless you learn much more you can't find much practical use to many things .. But it's also too early to do so. Although he didn't dive much into it, you can create new types of data(or variables I could say) with classes. Like strings, that's how they were made. And you'll see later they have function in them that you call like you call a class's functions. And I doubt he should start talking about binary trees, linked lists from now etc..
The difference in assigning a variable in the member init vs in the actual constructor is almost none. You can assign it wherever you like really. There's only a difference if you create a const int i; without assigning a variable, this is legal c++ code as long as it is in a class. But this variable then has to be assigned in the constructor using the member init. If you create a const without assigning it in the member init you'll get an error. If you assign the const in the constr uget eror
nonpensarediesserlo A constructor is used when you are creating an object for a class. You're "initializing" your class for use. A member initializer is used to initialize individual variables for use within a function, in your class. Nax You explained it perfectly! nonpensarediesserlo I made a pastebin with everything Nax described: pastebin.com/2EFGgeyw Enjoy!
Once I started programming, my spelling and typing went out the window... Does anyone else experience this? I think this is what Bucky is suffering from...
+Todd "Sally::Sally" means the constructor function "Sally" belongs to the class "Sally". This syntax is similar for defining other functions. For example, "Sally::print()" means the "print" function belongs to the "Sally" class.
One way in which to do this is to create 2 public functions. One of these will set the variable, the other one will get it. For example: int varGet() //Gets the variable from private { return var; } varSet(int x) //Sets the variable in private, allowing the value to be changed { var = x; } These would then be called in the program: int main() //In this case the number 5 should be the return value { Class object; //Create object of class object.varSet(5); //Set the variable "var" to 5 object.varGet; //Return the value of "var", which should be 5 } The private section can only be accessed by functions/methods of the same class, hopefully I made this some-what clearer for you.
I'm getting an error constVar is not declared at this scope ||=== Build: Debug in new (compiler: GNU GCC Compiler) ===| C:\Users\xxxx\sally.cpp||In function 'void print()':| C:\Users\xxxxx\sally.cpp|11|error: 'regVar' was not declared in this scope| C:\Users\xxxxx\sally.cpp|12|error: 'constVar' was not declared in this scope| ||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===| can someone help me out ???
TheEdoRan Hi, need to re-do the whole thing one more time as far as i remember i done all exactly the same like in the vids Maybe my code::blocks config is all wrong
TheEdoRan Hey :) don't know how but it started to work. i don't get it but as it seems I'm getting constant problems when I'm renoving the using namespace std; is it like recomended to use this ?? seen lots of aps code without it. thanks
Hello, Error is inside of main, and i create object: Mateo ma(4 ,50); ma.print(); I get error at number 4 its say: cannot access private member declared in class 'Mateo' I just do as in video, just rename my variable and class. Can't find solution, help...
You also need to put " \ " just before hitting the enter key so compiler ignores the newline(At least in my compiler). I know it too late but just saying.
Just a question and what i think , I see this and then realize after all I've learned so far what the hell am I learning. What can I do with all this im looking for game design but i don't know the first thing?
***** simple console applicaitons all i learned too do was print out hi and i lvoe bacon and sally, i do appreciate the time this guy took out im still learning ,but When will i have the basic to actually do something what video helps me write acode to specific function for a game , or if i want to create my own private server an dcreate hacks for it just to b e able too to do that ,,and feel accomplished hey im pretty good. When do you get too use these functions , or what do these even mean CALL , RETN , JMP , JE stuff like that? Yes I know I have to understand all the stuff first thats why imma finish this , and move on to more c++ I just need a sense of i'm moving forward. Otherwise ill get discouraged , and feel like i'm not learning nothing and eventually quit.
hey Bucky, your tutorials totally rock! I have a problem, though. everything works fine when I type the code in notepad++ then run g++ in cmd to compile it. When I use code blocks it gives me these errors: undefined reference to `Sally::Sally(int, int)' and undefined reference to `Sally::print()' it works with hellp world, but won't with this
You need to compile include both your header file and cpp file using g++ as: _ g++ Sally.cpp Sally.h main.cpp -o main_ and then, run the _./main_ executable
I'm okay with the initialization part. But later through the program if I need to access the variables, how i'm gonna do it? I think we need to create getnum() func. to achieve it. Correct me if I'm wrong. Is there any alternative? Beginner.
What if you didn't make your classes in a different file. Only on your main file like on the earlier tutorial (Tutorial 13 to be exact), do you still need to list your members with that syntax for constant variables? Does it work for both single and multiple files?
John Lester Mercado Well, I try it myself. It still need those member initializers. Without it, it has an error: uninitialized member. CODES: #include using namespace std; class Sally { public: Sally(int a, int b) : regVar(a), constVar(b) { } void print() { cout
If you've made it this far and you've given your best efforts in your endeavors to understand C++, give yourself a round of applause. Close to a million people have watched the first video and many of them have stopped watching, and I'm going ahead to guess and say that they've given up. Not us though. We are determined and focused and we will master this programming language. Congrats to everyone so far as this is something we should all be proud of! Onward to tutorial 73!
Thank you for saying that! It brought some hope for myself and i'm sure for other people too. I'll see you at the finish line :D
Wo, dude thanks i agree with chris you did just give me alot of hope! See you both at the finish line.
***** It's like he said, you are required to do it this dumb way if you need constant variables in your class.
Brian Davis many of them have stopped watching because his lessons are pretty low...you won't get a job in C++programming with these kind of lessons that he presents here
You need all these lessons before you can move on to more advanced stuff. pascalirinel
It's been 5 years but to enable word warp:
Settings -> Editor -> General Settings -> Other editor settings(second tab) -> check box "Word warp".
Awesome tuts by the way.
it's been a year, but word wrap* ;)
"Make sure you spell it wrong." - Bucky
It's 8 years... Damn
@@gluebluerock136 9 years !!!!
@@youssefa.8313 9 +a few mos
In case you have not found out it yet - to wrap words: go to main menu Settings ( right before Help), Editor, Other Options, Word wrap.
To Copy/ Paste with right click - right click, hover Edit - there are all regular Edit options. A long option though.
Damn it has gotten crazy! You the best teacher though I don't think I would have gotten this far without you. 🙏🌿💯✌️
I followed the Java Beginner and Intermediate tuts and I when I wanted to learn C++ I just searched in your channel right away!
Why do other people have to make this stuff so complicated?
This is super easy!
When shown with regVars and Tunas it all makes sense.
Thanks Bucky
--> Word Wrap Setting in CodeBlocks
keep working hard and doing the right thing everyday- Adam Morrison
yup,He is great in explaining difficult things in simple ways..thank u Bucky..i am searching for your more and more videos..
This is the one video from you I had to replay lol. At first, this confused me.
Damn perfect tutorial. Yes the syntax is pretty fkd up.
Because the compiler reads the code char by char, it doesn't matter the tabs or breaklines, you could wrote an entire program using one line
we can also do it in this way....
Sally::Sally(int a,int b){
regVar = a;
constVar = b;
}
this works same and its pretty simple
Go on this link and share with your friends
i tried and it didn't work. You didnt specify the type of regvar. even if you did, it still wouln't work. idk why
It doesn't work m8.
this tends to be slower, amongst other things
Does or not work? Can't type now on my computer 🤔
Dude, if you have programmed in other languages that's REALLLLLLLLY weird putting code between paremeters and start of statements.
Ikr c++ is very quirky in this sense.
thing is, if we are going to assign the values before the brackets, then why are they even there?
Yeah even though that feature is there I always just put it in the brackets
reallllllly sounds weird... I prefer reaeaeaeaealy... wtf... that doesn't look right. aw fergetid
watch , learn , forget
That's why you should watch only a few episodes a day and consolidate the lessons on your PC, in your Visual Studio/CodeBlocks, by yourself. And as we Russians say: repetition is mother of teaching.
This is the 45th tutorial i am watching today...
Hell yeah brother!
When you type something with cout,instead of doing this:
cout
How he used that private class member to print the output
In one of his previos videos he said that we can't access the private class directly.but its working..help plz
he accessed that private class member by using a function which is also of the same class
he then ran that function
You can manipulate private variables through functions of the same class! The constructor is one of those
@@jaunathang thansk for the intel
At tutorial 45. Well I think everyone include myself has done pretty well getting this far. Can't wait for inheritance looked around at afew C++ game developing videos and you seem to need inheritance for alot of stuff.
What makes this better than saying, for instance:
Sally::Sally(int a, int b)
{
Sally::regVar = a;
Sally::constVar = b; // Will throw an error I figured.
}
I will use member initializers since it allows you to initialize const variables but besides that whats the point?
I can see maybe calling Sally::regVar is an issue as a reference to the entire class and not the object being initialized, an example of what I mean in Java is
public Sally(int a, int b){
Sally.a = a;
Sally.b = b;
}
though in Java this is easily remedied with the "this" keyword which doesnt have the same function in C++.
So is it simply as a safety measure and as a way to initialize any member variable at construction?
Can someone please tell me why i get "No such file in the directory" when I try to run the program? I saved all files in the same place. when I was creating the class, I unchecked destructor and the visual thing and also unchecked relative path.
Alseny Sylla i have been having the same error :/
+Alseny Sylla check to see if #include "......h" not #include in your main.ccp
It's mostly a matter of preference, go with what you think is the best.
The two variable is inn the private part of the class but you don't need a function to set it and get it? Why? Is it because it called from the constructor?
Matthew Sam Suren yes
And guess what, you didn't hear a "pretty cool huh?!"in this tutorial. :P
word wrap? use \ somewhere in your line and press enter. It helps you to continue your code on the next line without using another cout.
What about references or built-in arrays? What about initializing objects that don't have a default constructor? What about an object that is expensive to default-construct, but that you just discard anyway when you assign to it in the body?
simple english.love it
Before C++11, your source file had to end with a newline, so technically, the smallest valid program possible pre-C++11 is two lines.
thanks men, you save my life.
For Word Wrapping:
Settings -> Editor -> Word Wrap checkbox
You're free to go
hey Bucky um can you tell me if your gonna make c++ game programming tutorials or if your gonna remake your java game programming tutorials?
variabel
Bang bang Sally, Sally bangs all day!
Who we gunna bang on, when Sally goes away!?
Weird flex but ok
@MrHartl1ey a lot
These series are the shiz ! brothumbs for u.
Would it still work if I input:
Sally::Sally(int a, int b) {
regVar = a;
constVar = b;
}
Sebastian Ceblano no
@@neonblood4658 why?
You can easily enable word wrap : Settings>Editor>Other Options(Legend)>Word Wrap...Simple enough?
what about for vector or class arrays[] ??
any idea how undestand what you said even in some video, need help !
So, "Encapsulation" can be done with this then? I'm getting mixed up now!
please answer any1..... when do we need to use this functins??????????
thanks bucky you make c++ easyer and funn
What if we want to do a type check before assigning value in constructor????
At 5:52 , Bucky says that Sally so( )is a constructor but as i remember a constructor always has the same name as that of the class.Can anyone explain?
Hi Bucky, first of all THANKS SO MUCH for your tutorials,
i've just got a couple of questions regarding this tutorial, in the previous one you wrote 'const' at the end of the () in the sally.h file, but now you put it in the front of your variable, does that make any difference? And also, you only made one object, but it was able to reach both the regular and const variables, whereas in the previous tutorial you said u'd need a 'const' object to access const variables? please clarify? Thanks!:)
When I create multiple object and pass different values to each objects in main function the value of constant variable is also modified which by definition should not. The two parameters which the object takes is an integer and a constant variable.
Can someone explain? Thank you.
You don't need 'Word-Wrap' because you can just hit enter in the middle of a line, and continue the remaining code on the next line. C++ allows this.
ex. ' cout
Bucky, you inquired as to why the member initializer list goes between the right parentheses & the left curly brace? It's because that they - the other software language developers - hit me with the question so fast and furious and thus demanded an answer right away!
So THE LORD had me respond with that particular position simply because there was no other convenient place to put it! Anywhere else, and that space was already taken - defined - and there simply wasn't any more key characters on the keyboard that would properly fit the situation at hand. So, the only logical conclusion that we came up with (in such short notice) was to place the member initializer list between the parenthetical statement and the curly brace statements declarator.
Now, do you understand? Does it make sense? Can you come up with a better system? Think about it!
Grace of God, Peace of Jesus Christ, and Love from,
~ The Holy Ghost
+Dennis Charles Smart Dude Please -_-
How you initialize a const function...?
I am constantly getting the error
" In function main Undefined reference to 'Sally::Sally(int, int)' " since 2-3 videos
Can someone help?
Google it 😉
Lol I would help but its been 2 years.
Not sure what i'm doing wrong but I can't seem to be able to initialize strings this way. Somebody help?
Bukky i love your videos but can you please tell me how many more c++ tuts you plan to do because i think they are the best.
Total 73 tutorials
Bucky asked in the video if there was a way to word wrap...
Cant we do it like this ?
Sally :: Sally(int a , int b){
regVar = a ;
constVar = b;
}
Even here we are just intializing the variables, since Sally() is executed the moment an obj is created i dont think it will make a difference.
Is it possible to use member initailizer in a derived class to initialize protected variable from the parent class?
Bucky, just press enter and continue your line on the next line. The CR will have no effect.
ITS probably gonna help people à lot to pic all THE Tuts handeling arrays And constants after Each other... I did anyways And iT helped pretty Well.
this code not working for Visual Studio 2015, any help???
Why cant initialize in the constructor??? like this..
MyClass::MyClass(int a , int b){
num=a;
constnum=b;
}
Dangit... Mine won't work... Won't even compile now. Hate it when this happens cause it always takes so long to fix...
Putitng something between parameters and the body?!?!? He is a wizzard!!!!
@hbaderman Well .. Unless you learn much more you can't find much practical use to many things .. But it's also too early to do so.
Although he didn't dive much into it, you can create new types of data(or variables I could say) with classes.
Like strings, that's how they were made. And you'll see later they have function in them that you call like you call a class's functions.
And I doubt he should start talking about binary trees, linked lists from now etc..
To word rap =
Settings->Editor...->General Settings->WordWrap
Although I'm sure you've got it by now..
If we have to initialize a constant variable in a function, we do it this way or the normal one? Please help!
what does the regular variable need to be included with the const variable when creating the function or constructor?
The difference in assigning a variable in the member init vs in the actual constructor is almost none. You can assign it wherever you like really.
There's only a difference if you create a const int i; without assigning a variable, this is legal c++ code as long as it is in a class. But this variable then has to be assigned in the constructor using the member init. If you create a const without assigning it in the member init you'll get an error. If you assign the const in the constr uget eror
Is it for same reason as pass by refernce or something else,exepect that to it's in class
Hi everyone,
I am wondering what's the difference between a CONSTRUCTOR and a MEMBER INIZIALIZER... Is there someone that could explain that?
Thanks
nonpensarediesserlo
A constructor is used when you are creating an object for a class. You're "initializing" your class for use.
A member initializer is used to initialize individual variables for use within a function, in your class.
Nax You explained it perfectly!
nonpensarediesserlo I made a pastebin with everything Nax described:
pastebin.com/2EFGgeyw
Enjoy!
Besides const variable, is there any other scenario that we have to use member initializer technique.
why is it call member initializes instead of variable initializes? what would initializing a function look like?
Bucky, you're a funny dude.
Once I started programming, my spelling and typing went out the window... Does anyone else experience this? I think this is what Bucky is suffering from...
MEEEEE
But cant we assing them in the body of the constructor? Just like the normal way?
did everything he said to doo and it say reg var and const var not declared.
Can someone explain what the use of the double colon is in his *Sally.cpp tab where it says "Sally::Sally"?
+Todd "Sally::Sally" means the constructor function "Sally" belongs to the class "Sally". This syntax is similar for defining other functions. For example, "Sally::print()" means the "print" function belongs to the "Sally" class.
Makes sense now, thank you!
It tells the program that hes working with the sally class.
thank you so much! you saved my life :D
How r you Accessing the variables that are in Private Class ?? Beginner
One way in which to do this is to create 2 public functions. One of these will set the variable, the other one will get it.
For example:
int varGet() //Gets the variable from private
{
return var;
}
varSet(int x) //Sets the variable in private, allowing the value to be changed
{
var = x;
}
These would then be called in the program:
int main() //In this case the number 5 should be the return value
{
Class object; //Create object of class
object.varSet(5); //Set the variable "var" to 5
object.varGet; //Return the value of "var", which should be 5
}
The private section can only be accessed by functions/methods of the same class, hopefully I made this some-what clearer for you.
thanks
Just few more tutorials to go
I'm getting an error constVar is not declared at this scope
||=== Build: Debug in new (compiler: GNU GCC Compiler) ===|
C:\Users\xxxx\sally.cpp||In function 'void print()':|
C:\Users\xxxxx\sally.cpp|11|error: 'regVar' was not declared in this scope|
C:\Users\xxxxx\sally.cpp|12|error: 'constVar' was not declared in this scope|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
can someone help me out ???
did you defined the variables in the header file? and/or, did you included the header file in the source file?
TheEdoRan Hi,
need to re-do the whole thing one more time
as far as i remember i done all exactly the same like in the vids
Maybe my code::blocks config is all wrong
TheEdoRan Hey :)
don't know how but it started to work. i don't get it but as it seems I'm getting constant problems when I'm renoving the using namespace std;
is it like recomended to use this ??
seen lots of aps code without it.
thanks
+Ticomfreak cheers for that! Thanks
Hello,
Error is inside of main, and i create object:
Mateo ma(4 ,50);
ma.print();
I get error at number 4 its say: cannot access private member declared in class 'Mateo'
I just do as in video, just rename my variable and class.
Can't find solution, help...
Here:
s23.postimg.org/8nmib4o8r/aaa.png
It's,
Mateo.cpp
Void Mateo::Print(){
...
}
It's public
look at the comment under you (if you haven't figured it out by now 9 months)
Hey dood u said a lot more tuts but pleease tell me r u going to teach some more advanced stuff on c++
I remember the last 30 seconds!
cout
You also need to put " \ " just before hitting the enter key so compiler ignores the newline(At least in my compiler). I know it too late but just saying.
can someone tell me why i get an error that regVar hasn't been declared int his scope please guys help
well explained!!
@thenewboston Bucky will you do tutorials on Game development using c++..
Where is the const function for the constVar?
What is the difference between member initializer and a constructor ?
Thank you Bucky, i hope you do Jquery after javascript tuts :)
hmm.. why not just assign regvar = a?
No problem with a regular variable, but with a constant variable you have to use the member initializer.
volikoto but why? Whats the purpose with this rule?
Is it still like that in C++14?
You can just press enter after a "
makes code look messy
So a constant is a variable that isn't variable... got it
check that you have
void sally::print(){ .... or w/e method title you used...
its not printing out and not picking up object so
Just a question and what i think , I see this and then realize after all I've learned so far what the hell am I learning. What can I do with all this im looking for game design but i don't know the first thing?
***** simple console applicaitons all i learned too do was print out hi and i lvoe bacon and sally, i do appreciate the time this guy took out im still learning ,but When will i have the basic to actually do something what video helps me write acode to specific function for a game , or if i want to create my own private server an dcreate hacks for it just to b e able too to do that ,,and feel accomplished hey im pretty good. When do you get too use these functions , or what do these even mean CALL , RETN , JMP , JE stuff like that? Yes I know I have to understand all the stuff first thats why imma finish this , and move on to more c++ I just need a sense of i'm moving forward. Otherwise ill get discouraged , and feel like i'm not learning nothing and eventually quit.
***** I see , so i guess these tutorials are a waste of time.
why did u have to pass reg var in and const var. Why couldn't you just set those variables equal to numbers.
Worked with const int, but failed when I tried to pass "const string". Does this method work only for "const int" type?
hey Bucky, your tutorials totally rock! I have a problem, though. everything works fine when I type the code in notepad++ then run g++ in cmd to compile it. When I use code blocks it gives me these errors: undefined reference to `Sally::Sally(int, int)' and undefined reference to `Sally::print()' it works with hellp world, but won't with this
You need to compile include both your header file and cpp file using g++ as:
_ g++ Sally.cpp Sally.h main.cpp -o main_
and then, run the _./main_ executable
@@raz0229 u dont have to include the slally,h, only the cally.cpp
@@raz0229 so it shoudl be like this
g++ main.cpp Sally.cpp -o Sally.exe
Sally.exe
I'm okay with the initialization part. But later through the program if I need to access the variables, how i'm gonna do it? I think we need to create getnum() func. to achieve it. Correct me if I'm wrong. Is there any alternative? Beginner.
Ritvik Raj Actually you're right you would make a getnum() and a setnum().
What if you didn't make your classes in a different file. Only on your main file like on the earlier tutorial (Tutorial 13 to be exact), do you still need to list your members with that syntax for constant variables? Does it work for both single and multiple files?
John Lester Mercado Well, I try it myself. It still need those member initializers. Without it, it has an error: uninitialized member.
CODES:
#include
using namespace std;
class Sally
{
public:
Sally(int a, int b)
: regVar(a), constVar(b)
{
}
void print()
{
cout
variabel is german ^-^ so technicly you're still right
I followed every step of yours but just can not build and run............
+Gavin Hoang It could be your compiler issue. Try deleting everything and start a new project. I faced the issue too.