Riccardo
Turbo are you alive?
Anonymous
#include<iostream>
using namespace std;
class A{
public:
static int a;
A(){
a = 1;
}
};
class B:public A{
public:
B(){
a = 5;
}
};
int main(){
A a;
cout<<A::a<<endl;
B b;
cout<<B::a;
return 0;
}
Anonymous
I'm doing this in cpp and compilation says:
Anonymous
(base) Ajays-MacBook-Air:Desktop ajay$ g++ static.cpp
^[[A^[[A^[[AUndefined symbols for architecture x86_64:
"A::a", referenced from:
A::A() in ccxRzWZ6.o
A::A() in ccxRzWZ6.o
B::B() in ccxRzWZ6.o
_main in ccxRzWZ6.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
Anonymous
Can anyone explain?
Dima
you need to declare a
Dima
somewhere in the cxx file: int A::a = 0;
Dima
don’t name classes/whatever like that tho.
Anonymous
aa thaks dima love youe
Anonymous
hello dima
Anonymous
which a r you talking about
Anonymous
#include<iostream>
using namespace std;
class A{
public:
static int x;
A(){
x = 1;
}
};
class B:public A{
public:
B(){
x = 5;
}
};
int main(){
A a;
cout<<A::x<<endl;
B b;
cout<<B::x;
return 0;
}
Anonymous
Check this out
Anonymous
(base) Ajays-MacBook-Air:Desktop ajay$ g++ static.cpp
Undefined symbols for architecture x86_64:
"A::x", referenced from:
A::A() in ccoNr3Em.o
A::A() in ccoNr3Em.o
B::B() in ccoNr3Em.o
_main in ccoNr3Em.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
Anonymous
Do I need to declare the static x outside of the class
Dima
yes this is what I said
Anonymous
So, that means A::x=which value?
Anonymous
I mean inside the constructor I'm re-initialising x
Anonymous
So, which value should be set?
Anonymous
42
Anonymous
Or 69 based on your preference
Anonymous
hmm
Anonymous
Most people use 0 though.
Anonymous
How boring.
Francesco
Anyone wants help?
Francesco
We can make a project
Sachin
Where to practice stl of c ++?
kvark
amazing, but you can do it anywhere)
kvark
but not in public place, be careful
Anonymous
Which is best c and c++ learning app tell me
Anonymous
And also tell me about function and pointer in c /c++
Anonymous
Anonymous
Single line ohhhh god
Anonymous
My opinion is that C would be easier to learn because it has less overall features, but its low level might put some off initially.
Anonymous
https://img.devrant.com/devrant/rant/r_1319179_RPWjn.jpg
Talula
Anonymous
Talula
Books
Google... and YouTube.
Anonymous
Google... and YouTube.
Internet has a lot of shitty content which teach bad practices. But there are good resources available though
Dima
Marwan Alsulami
guys any one here know regular expression ?
Marwan Alsulami
Anonymous
Andrea
I agree, the solution as state in the image is already the correct one
Anonymous
It can be easily parsed with one loop
Francisco
Anonymous
I know what a regex is
Anonymous
What should regex check in this task?
Anonymous
What should it do*
Andrea
give a regexp that match the same language
Francisco
The language generated is n a's followed by the same amount of b's. By theory, there's no regex that can parse every word in that language
Anonymous
Francisco
Anonymous
Anonymous
Any friend give me FUD Android Rat
Talula
I don't have FUD on me.
Anonymous
Hi
Anonymous
Anonymous
What is the output of this program
I_Interface
Mat
Mat
What do you expect?
many
I'm learning template metaprogramming. Is it common in commercial usage?
Dima
kinda
Anonymous
What kind of applications can be built using c++?
Dima
What do you think?
Dima
Anything can be
Anonymous
Also AAA-games made with C++
Anonymous
But building one won't be much effective and efficient comparing to applications build using other languages right ?
Anonymous
I see
Anonymous
Thanks for the info
Anonymous
Anonymous
Building one application using c++ won't be much better comparing to the applications built using other languages like Python