C
cjlug
Is the following snippet generating UB, or not?
Strangely, it works fine on MS2008.
#include <iostream>
using namespace std;
class A
{
public:
void print() { cout << "A:rint()" << endl; }
}
int main()
{
A *a = NULL;
a->print();
}
A friend of mine said that A:rint() isn't depending on A since it's
not virtual and it's not accessing members of A, so it's 'sort of'
static, in terms that it has a known address and can be accessed
without having an instance of an object, like statics.
What's the entire true?
Strangely, it works fine on MS2008.
#include <iostream>
using namespace std;
class A
{
public:
void print() { cout << "A:rint()" << endl; }
}
int main()
{
A *a = NULL;
a->print();
}
A friend of mine said that A:rint() isn't depending on A since it's
not virtual and it's not accessing members of A, so it's 'sort of'
static, in terms that it has a known address and can be accessed
without having an instance of an object, like statics.
What's the entire true?