| | |
inherit class from structure
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Oct 2007
Posts: 1
Reputation:
Solved Threads: 0
0
#4 Oct 26th, 2009
richard bach, when I compile exactly what you have, i don't get a problem.
Using Visual Studio 2008. V.9.021022.8
I compile that and no errors, and I do actually get the numbers.
I don't know to what extend this works, but to this, it is working.
Using Visual Studio 2008. V.9.021022.8
C++ Syntax (Toggle Plain Text)
#include <iostream> using namespace std; class base { protected: struct node{}; }; class derived :public base { struct node *prev; }; class A { public: int a; }; struct B : A { }; struct C { public: int c; }; class D : public C { }; int main() { B b; D d; b.a = 1; d.c = 2; cout << b.a << " " << d.c << endl; }
I compile that and no errors, and I do actually get the numbers.
I don't know to what extend this works, but to this, it is working.
![]() |
Similar Threads
- Please help me to convert a simple C++ program into an object-oriented one. (C++)
- Several C++ Designing Questions (C++)
- What is the best value for an empty point in C++? (C++)
- Basketball League Project (C)
- Inheritance Questions (C++)
- Why use a Python class? (Python)
- Dynamically Print Out Structure Contents (C++)
- accessing private data members (C++)
Other Threads in the C++ Forum
- Previous Thread: Problem deleting pointers from list
- Next Thread: File Creation Program
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code compile compiler console conversion convert count data delete deploy dll download dynamic dynamiccharacterarray encryption error file format forms fstream function functions game givemetehcodez graph gui homeworkhelp iamthwee ifstream input int java lib library linkedlist linker list loop looping loops map math matrix memory microsoft newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference rpg simple sorting string strings temperature template templates test text text-file tree url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets






