aforementioned code snippets do not regard the restrictions ... I dont want to create objects of A
I was thinking in terms that ... since member functions are not saved on per instance basic......
Type: Posts; User: vb.bajpai
aforementioned code snippets do not regard the restrictions ... I dont want to create objects of A
I was thinking in terms that ... since member functions are not saved on per instance basic......
class A
{
void foo()
{
}
};
class B
{
thank you! , solves all the troubles
btw... what is the difference between -pedantic and -Wall arguments in gcc ?
I have been using -Wall instead of -pedantic ... so the warnings were bypassed
ok ... the trouble started with sizeof(void) = 1
on similar terms sizeof empty class/structure in C++ is also 1
Bjarne Stroustrup's FAQ reasons: "To ensure that the addresses of two different...
Inline Functions have numerous advantages over macros
but is there any scenario when macros can prove advantageous over inline functions?
referring to ANSI C book by K and R
"With a little care it is easy to write portable programs, The standard makes portability issues explicit"
I expects, he hints me, that the C language...
yeah, bcoz it was never overriden!
Suppose I have class in a library whose method i wish to override, but it is not declared virtual
How can I go about overriding the method?
all methods in Java are virtual so, no such problem...
I tried this :-
#include<iostream>
using namespace std;
class A
{
int x;
wow!
initializer list is the only way i could initialize non-static const members
thanx!
tried this :-
class A
{
public:
const int x;
};
Can i not declare a non-static const data member?
class A
{
public:
const int x;
A()
{
I know we cannot use static as modifier for a constructor
but we do need a static constructor to initialize all the static data for a class.
C# explicitly provides static constructors for this....
so, are they stored in Heap or Stack???
Structs in C++ are stored in Stack/Heap?
What will be the default value of my struct type?
Assignment of struct types on to another struct type will copy values or reference?
Referring to - http://www.codeproject.com/csharp/structs_in_csharp.asp
Although the CLR allows it, C# does not allow structs to have a default parameterless constructor. The reason is that, for a...
I read in C++ vs C# section
C# does not provide defaults for constructors unlike C++
what does that mean?
referring to - "http://msdn2.microsoft.com/en-us/library/szx2ta7y(vs.80).aspx"
"There are two restrictions on the use of destructors. The first restriction is that you cannot take the address of a...
thank you !
In this specific instance, agreed. No offense, vb.bajpai, but I don't quite think you're ready for this yet.
I understand, I m just a C++ Beginner
Thanx for the first 2 answers, but the third part still remains unanswered
referring to http://www.parashift.com/c++-faq-lite/freestore-mgmt.html#faq-16.15
not by new[], nor by placement new, nor a local object on the stack, nor a global, nor a member of another object;...
thanx !
#include<iostream>
using namespace std;
int main()
{
const int x = 10;
int *p=NULL;
cout<<x;
p = const_cast<int*>(&x);
if(p)
#include<iostream>
#include<typeinfo>
using namespace std;
class A{};
int main()
{
A a;
cout<<typeid(a).name();
ok thanx
one more doubt -
#include<iostream>
using namespace std;
class A
{