Connecting...

This is a quick preview of the lesson. For full access, please Log In or Sign up.
For more information, please see full course syllabus of Intermediate C++
For more information, please see full course syllabus of Intermediate C++
Intermediate C++ Object Oriented Programming, Part 2
Lecture Description
In this lesson, our instructor Alvin Sylvain goes through an introduction on part two of Object Oriented Programming. He discusses initialization lists, destructors, name components, friendship functions and classes designing for derivation, abstract class, compilation units, and include guards.
Bookmark & Share
Embed
Share this knowledge with your friends!
Copy & Paste this embed code into your website’s HTML
Please ensure that your website editor is in text mode when you paste the code.(In Wordpress, the mode button is on the top right corner.)
×
Since this lesson is not free, only the preview will appear on your website.
- - Allow users to view the embedded video in full-size.
Next Lecture
Previous Lecture
1 answer
Sun Nov 16, 2014 2:50 PM
Post by Ram Manohar Oruganti on November 13, 2014
Mr. Sylvain, I wrote this piece of code:
#pragma once
class aux
{
public:
int dummy;
aux(){dummy = 0;}
virtual ~aux(){}
};
class test
{
public:
int dummy;
test(void);
virtual ~test(void);
static unsigned int MRU_count;
static aux *MRU_block;
};
The above code throws errors without the following lines in the header files:
unsigned int test::MRU_count=0;
aux q;
aux *test::MRU_block = &q;
And it wouldn't allow me to define these in the main function, saying these can't be defined in the current scope. Why is that?
Also why am I supposed to mention the data type again? Shouldn't the compiler get it from class definition?
I am using Visual Studio, if that makes any difference. Thanks in advance.
0 answers
Post by Ram Manohar Oruganti on November 12, 2014
So, Mr. Sylvain, I want to make sure that I have it right. Any class with a pure virtual function becomes abstract; is that correct?