CFanatic

Go Back   CFanatic > Programming > C++ Programming > Managed C++


  #1  
Old 07-02-2010, 12:23 AM
Junior Member
 
Join Date: Jul 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
ZhiYi is on a distinguished road
| More
Post Can Derived Class Contain Vector of pointers to the parent class?

Lets say I have a parent class called:

class Car
{
.....
};

Then there is a derived class called Toyota, which has a method returning a pointer to the parent class and a vector of pointers of the parent class.

class Toyota : class Car
{
public:

*Car GetCar(char* model);

private:
std::vector<Car*> cars;
};

Is this allowed?

I came across this programming question which requests for a class and a derived class where the derived class has a container of pointers to the parent class and individual elements of the container has to be accessed quickly.
(This question is neither a school assignment nor a test)

:s11:
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Logger Class in C++ senseiwa C++ Programming 0 06-28-2010 08:16 AM
Pointer and Class inspiration C++ Programming 8 05-31-2010 08:55 PM
How to enforce a virtual fn is overloaded by derived class? Alex C++ Programming 0 04-12-2009 07:31 AM
get Class johny10151981 Win32 Programming 1 10-07-2008 03:58 AM
changing variable types of a function of a derived class mrclash C# Programming 0 09-20-2006 04:56 AM

 

Follow CFanatic on Twitter
CFanatic Search
Custom Search

Advertisement

Go4Expert's Job Board
Powered by

Go4Expert Newsletter
Enter your Name and Email Address below and Click Subscribe.

Subscriber Counter

Not planning to subscribe yet, browse Go4Expert's Newsletter Archive

All times are GMT -5. The time now is 03:25 PM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO ©2010, Crawlability, Inc.
Looking for work in C, C++, C#? Sign up at Elance and search over 30,000 Freelancing jobs today.